日期:2014-05-16  浏览次数:20613 次

那些你可能不常用却很有用的Linux命令及配置

1. du -sh directory     查询directory占用磁盘空间的大小du -sh * 可查看当前目录下所有文件夹所占空间大小,如果直接用du -sh可查询当前目录占用的磁盘空间。

long@long-Ubuntu:~$ du -sh *
28K	forsystempro
370M	Git
12M	ipbench2
761M	linux-3.7.1
719M	linux-3.7.3
184M	mywork_g1_s2

2. grep -v [pattern] [file1, file2...]      用来输出文件中不包含pattern形式的行。

                   
3. ls --full-time       显示文件被修改的详细时间,包括年月日时分秒,还有时区。
           
long@long-Ubuntu:~$ ls --full-time
总用量 188
drwxrwxr-x  2 long long  4096 2013-01-05 09:19:16.849998240 +0800 forsystempro
drwxrwxr-x  3 long long  4096 2013-01-03 12:16:27.023333001 +0800 Git
drwxr-xr-x 10 long long  4096 2013-03-05 23:27:21.436202000 +0800 ipbench2
drwxrwxr-x 24 long long  4096 2013-03-07 13:58:52.808348013 +0800 linux-3.7.1
drwxrwxr-x 23 long long  4096 2013-02-24 16:48:08.186917994 +0800 linux-3.7.3

                                   
4. 统计文件总数
包括当前目录及子目录:find . -type f | wc -l
统计子目录个数:ls -lR|grep "^d"|wc -l
参考链接:http://bbs.linuxeden.com/thread-165574-1-4.html
          &nbs