[基础]常用linux命令 备查
=================文件操作==================
不使用find直接使用通配符对文件操作:
cp ./*/*attch* /testout_attch/
文件内容显示
head/tail:
## (1) displays the first 6 lines of a file
head -6 readme.txt
## (2) displays the last 25 lines of a file
tail -25 mail.txt
## (3) display the file from 11 to 20
head -20 file | tail -10
tail -f 刷新显示
==================安装卸载==================
rmp相关:
查看是否安装 rpm -qa | grep
是否安装 rpm -e (–nodeps) 软件包
===================运行===================
查看历史:
history|less
(export HISTTIMEFORMAT='%F %T '增加环境变量显示时间)
!N 运行第N条指令。
===================磁盘===================
文件文件夹大小:
du --max-depth=N -h(--human-readable)
du -a(all)b(bytes) = ll
磁盘空间:
fdisk -l = fdisk /dev/sda1 ->p
df
===================进程===================
查看进程:
ps -ef|grep httpd|wc -l
ps -auxf
===================网络===================
查看端口:
netstat -an|grep -i "80"|wc -l
查看dns包括ns记录,a记录,mx记录
查找yahoo.com的a记录:
dig yahoo.com a +noall +answer
查找yahoo.com mx记录的列表:
dig yahoo.com mx +noall +answer
查找yahoo.com的权威dns:
dig yahoo.com ns +noall +answer
查询上面所有的记录:
dig yahoo.com any +noall +answer
===================查询===================
find -anewer
(touch -d xx)
find -exec commond "{}"
(find .-name '*.zip' -exec unzip "{}"\;)
===================压缩====================
tar命令:
-c:压缩
-x:解压
-t:查看内
相关文档:
Linux 运行的时候,是如何管理共享库(*.so)的?在 Linux 下面,共享库的寻找和加载是由 /lib/ld.so 实现的。 ld.so 在标准路经(/lib, /usr/lib) 中寻找应用程序用到的共享库。
但是,如果需要用到的共享库在非标准路经,ld.so 怎么找到它呢?
目前,Linux 通用的做法是将非标准路经加入 /etc/ld.so.conf,然后运行 ldconf ......
在root模式下: # #delete files in trash # #date:2010-3-5 # #maker:tootwo # dir=/root/.Trash [ -d $dir ] x=$? y=0 if test $x -eq $y then (for i in $dir/* do &nbs ......
ifconfig eth0 新IP
然后编辑/etc/sysconfig/network-scrIPts/ifcfg- eth0,修改IP
一、修改IP地址
[aeolus@db1 network-scrIPts]$ vi ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=219.136.241.211
NETMASK=255.255.255.128
GATEWAY=219.136.241.254
二、修改网关
vi /etc/sysconfig/network
N ......
vi -r filename :在上次正用vi编辑时发生系统崩溃,恢复filename
移动光标命令
h:光标左移一个字符
l :光标右移一个字符
j :光标下移一行
k:光标上移一行
^ :行开始处
$
:行结束处
gg:移动到文件的开头
G :移动到文件的末端
[Ctrl] f : 翻页。
[Ctrl]
b:往回翻页。
修 ......