lunix常用命令和技巧(Red Hat Enterprise Linux Server release 6.2)

查看系统版本

cat \etc\redhat-release

查询进程

ps -aux|more

查看磁盘

df -h #M
df -k #kb

查看内存

free -m
cat /proc/meminfo

CPU

cat /proc/cpuinfo #配置
top #使用情况

启动模式

vi /etc/inittab#0关机 1单用户 2本地多用户 3带网络多用户 4自由用户 5图形多用户 6重启

关机

init 0#sync;init 0(sync:磁盘写入内存数据)
shutdown -h now
halt (poweroff)#强制关机

tar

-c #create
-x #解开压缩文件命令
-t #查看压缩文件内的内容,cxt只能同时存在一个
-f #使用档名,注意后面直接接文件名
-j #bzip2属性
-z #gzip属性
-p #保留源文件属性
-P #使用局对路径
-N yyyy/mm/dd #该日期之后的才能被打包
--exclude file #不包含file
tar cvf /tmp/etc.tar /etc#/etc打包
tar zcvf /tmp/etc.tar.gz /etc #/etc打包并以gzip压缩
tar jcvf /tmp/etc.tar.bz2 /etc #/etc打包以bzip2压缩
tar zxvf /tmp/etc.tar.gz etc/passwd #解开压缩包内的passwd

grep

grep 'abc' a* #显示所有以‘a’开头的文件中包含‘abc’的行
grep 'abc' a b c #显示在a,b,c文件中包含‘abc’的行 正则表达式需要加强了解

你可能感兴趣的:(linux)