不会的要多查多问,不然不会的永远不会,哪怕你离会就差了那么一点点
查看目录或者文件大小命令du
[ 2013/09/10 23:32 | by 刘新修 ]
查看当前目录下近子级目录占用大小(9.2M)是当前目录下总数:
du -h --max-depth=1
可以更改--max-depth参数的值,该参数表示查询子目录的层级,当前为1层
[root@www home]# du -h --max-depth=1
16K ./3snews_newsletter
16K ./3snews_zhuanti
16K ./chengqiang
4.2M ./memcached-1.4.7
116K ./admin
16K ./3snews_zhoukan
4.5M ./memcache-3.0.7
9.2M .
仅仅查看当前目录下的子目录大小,还可以用(不现实总数):
[root@www attachment]# du -sh ./*
4.0K ./album
4.0K ./category
64K ./common
3.8G ./forum
4.0K ./group
648K ./image
0 ./index.htm
4.0K ./mysql_info.php
4.0K ./portal
4.0K ./profile
4.0K ./swfupload
4.0K ./temp
[root@www attachment]# ls -l
total 44
drwxr-xr-x 2 apache apache 4096 May 24 08:44 album
drwxr-xr-x 2 apache apache 4096 May 24 08:56 category
drwxr-xr-x 3 apache apache 4096 May 24 08:44 common
drwxr-xr-x 46 apache apache 4096 Sep 5 09:11 forum
drwxr-xr-x 2 apache apache 4096 May 24 08:44 group
drwxr-xr-x 2 apache apache 4096 Sep 10 16:05 image
-rw-r--r-- 1 apache apache 0 May 24 08:56 index.htm
-rw-r--r-- 1 apache apache 27 May 24 08:56 mysql_info.php
drwxr-xr-x 2 apache apache 4096 May 24 08:56 portal
drwxr-xr-x 2 apache apache 4096 May 24 08:44 profile
drwxr-xr-x 2 apache apache 4096 May 24 08:44 swfupload
drwxr-xr-x 2 apache apache 4096 May 24 08:44 temp
[root@www attachment]#
查看当前目录占用总大小:
[root@www home]# du -sh
9.2M .
[root@www home]#