Techyou labs
真正的爱应该超越生命的长度,心灵的宽度,灵魂的深度
常用标签
您正在查看:标签 du 下的文章
January 3, 2010

Linux下查看目录大小的命令是du,从man中找到几个常用的参数就可以轻松的统计某个文件夹的容量.

* 1.统计出目录的总大小,并以比较合适的单位表示

-h, --human-readable
print sizes in human readable format (e.g., 1K 234M 2G)

-s, --summarize
display only a total for each argument

[Blinux@localhost test]$ du -hs /boot
5.7M /boot

* 2.当然了,你还可以让结果以单位b、k、m来表示

[blinux@localhost test]$ du -bs /boot
5746310 /boot
[blinux@localhost test]$ du -ks /boot
5772 /boot
[blinux@localhost test]$ du -ms /boot
6 /boot

* 3.显示目录的总大小及目录树中各文件夹的大小,并以较好的单位表示

[blinux@localhost test]$ du -h /boot
308K /boot/grub
5.7M /boot