du
-
du
显示当前目录的所有文件以及所有子目录的文件大小
cc@MyLinux:~/vundle$ du
8 ./test/files
20 ./test
8 ./.git/refs/heads
4 ./.git/refs/tags
8 ./.git/refs/remotes/origin
12 ./.git/refs/remotes
28 ./.git/refs
8 ./.git/info
4 ./.git/branches
44 ./.git/hooks
8 ./.git/logs/refs/heads
8 ./.git/logs/refs/remotes/origin
12 ./.git/logs/refs/remotes
24 ./.git/logs/refs
32 ./.git/logs
4 ./.git/objects/info
1020 ./.git/objects/pack
1028 ./.git/objects
1168 ./.git
8 ./syntax
48 ./autoload/vundle
56 ./autoload
8 ./ftplugin
20 ./doc
1328 .
-
du -h
以人类的角度直观的显示当前目录或指定目录/文件的大小
cc@MyLinux:~/vundle$ du -h
8.0K ./test/files
20K ./test
8.0K ./.git/refs/heads
4.0K ./.git/refs/tags
8.0K ./.git/refs/remotes/origin
12K ./.git/refs/remotes
28K ./.git/refs
8.0K ./.git/info
4.0K ./.git/branches
44K ./.git/hooks
8.0K ./.git/logs/refs/heads
8.0K ./.git/logs/refs/remotes/origin
12K ./.git/logs/refs/remotes
24K ./.git/logs/refs
32K ./.git/logs
4.0K ./.git/objects/info
1020K ./.git/objects/pack
1.1M ./.git/objects
1.2M ./.git
8.0K ./syntax
48K ./autoload/vundle
56K ./autoload
8.0K ./ftplugin
20K ./doc
1.3M .
-
du -s
显示文件目录总共大小(不分别显示子目录)
cc@MyLinux:~/vundle$ du -s
1328 .
-
du -sh
以人类的角度直观的显示文件目录总共的大小
cc@MyLinux:~/vundle$ du -sh
1.3M .
-du -hc file1 file2 file3 dir1
显示多个文件和目录的总容量(展开目录显示)
[cc@hadoop01 nginx-1.8.1]$ du -hc auto CHANGES conf LICENSE
32K auto/os
20K auto/lib/openssl
8.0K auto/lib/google-perftools
24K auto/lib/sha1
8.0K auto/lib/libgd
12K auto/lib/libatomic
24K auto/lib/zlib
8.0K auto/lib/geoip
8.0K auto/lib/libxslt
24K auto/lib/md5
28K auto/lib/pcre
12K auto/lib/perl
192K auto/lib
20K auto/types
52K auto/cc
448K auto
248K CHANGES
40K conf
4.0K LICENSE
740K 总用量
-du -shc *
显示当前目录下的文件和子目录(不展开子目录)的大小,并以人类直观的方式展现
[cc@hadoop01 nginx-1.8.1]$ du -shc *
448K auto
248K CHANGES
376K CHANGES.ru
40K conf
4.0K configure
100K contrib
12K html
4.0K LICENSE
4.0K Makefile
12K man
124K objs
4.0K README
4.4M src
5.8M 总用量
总结:
du 常用参数 -s -c -h 并且可以组合使用
-h, --human-readable print sizes in human readable format(e.g., 1K 234M 2G)
-c, --total produce a grand total
其他具体参数请查看man手册