du -h -d1 see only one directory statistics footprint

du -h -d1 see only one directory statistics footprint

[root@long ntp]#  du -sh -d1
du: warning: summarizing conflicts with --max-depth=1
Try 'du --help' for more information.


[root@long ntp]# du -h -d1     #-d1 表示当前目录只进入下一级目录
8.0K    ./crypto
20K .

-s and -d are mutually contradictory, so use

you -h -d1

Another rule of thumb is to write du -h --max-depth = 1

du  #查看当前目录下的,所有文件和目录
du -ah         #详细查看当前目录,子目录下的,所有文件和目录

--max-depth=n
    只输出命令行参数的小于等于第 n 层的目录的总计
-s, --summarize
    对每个参数只显示总和
-a, --all
    显示对所有文件的统计,而不只是包含子目录
-c, --total
    在处理完所有参数后给出所有这些参数的总计
-h, --human-readable
    为每个数附加一个表示大小单位的字母,象用M表示二进制 的兆字节
-l, --count-links
    统计所有文件的大小,包括已经被统计过的(作为一个硬连接)
-b, --bytes
    输出以字节为单位的大小,替代缺省时1024字节的计数单位


du -ah --max-depth=1 ./cdn  #统计cdn目录下,第一层的文件大小
du -sm * | sort -n    #统计当前目录大小,并安大小排序
du -h --time --max-depth=1 | sort -hr    #按大小排序目录(查看文件目录大小)

Guess you like

Origin www.cnblogs.com/longren/p/12469783.html