linux du queries the disk space occupied by the directory

linux du queries the disk space occupied by the directory

Disk space occupied by linux query directory

du -hxs /* --exclude=/proc |sort -rh

Explanation of commands and options:

du     估计文件的空间使用情况

-hsx  (-h)更易读的格式,(-s)汇总输出,(-x)跳过其他文件系统的文件

sort    对文本文件按行排序

-rh   (-r)将比较的结果逆序输出,(-h)更易读的格式

head   输出文件的头几行

--exclude 排除目录,因为proc目录是进程目录,会显示出如下不需要的信息,所以排除掉

du: 无法访问"/proc/12550/task/12550/fd/4": 没有那个文件或目录

Guess you like

Origin blog.51cto.com/6519883/2608201