工作中常用到的Linux命令

ps: (ps的参数分成basic, list, output, thread, miscellaneous)

(basic) -e / -A 显示所有进程

(output) -o 输出指定字段 

 

 

ls:

最常见的ll = ls -al就不说了:

-X 根据扩展名排序

-t 以文件修改时间排序

-S 根据文件大小排序

-r 依相反次序排列(默认是按照文件名排序的)

-d 将文件夹像文件一样显示,而不是显示其下的文件

-h 以人类看得懂的方式显示文件大小

ll | grep ^d 只显示文件夹

ll | grep ^- 只显示文件

 

grep:

-i 忽略大小写

-c 计算符合要求的行数

-v 取结果的补集

grep '\\' 或者 grep "\\\\" 查找反斜杠(单双引号的区别)

-E 支持正则表达式,如"^$|#"

-o 只显示匹配正则表达式的字符串

 

mount:

mount.cifs -o domain=corp.contoso.com,username=admin //10.27.31.132/share/ /mnt/techsupport/  或

mount -t cifs -o domain=corp.contoso.com,username=admin //10.27.31.132/share/ /mnt/techsupport/

( 如果不装cifs-utils则没有mount.cifs这条命令,而且会提示:

mount: //10.27.31.132/share/ is write-protected, mounting read-only
mount: cannot mount //10.27.31.132/share/ read-only )

 

df:

df -h 获得各文件系统的大小情况

 

du:

du -h --max-depth=1 ./ 获取当前目录下各个子目录的大小

du -sh ./ 获取当前目录的总大小

posted @ 2017-06-12 10:53  dongdonggeorge  阅读(317)  评论(0编辑  收藏  举报