du命令會查詢當前目錄下所有文件的大小並打印顯示
參數
-c 顯示當前目錄的總用量
[root@localhost ~]# du -c 4160 ./bin 6000 . 6000 總用量
-h 已K\M\G來顯示使用量
[root@localhost ~]# du -h 4.1M ./bin 5.9M .
-s 顯示當前目錄的總和
[root@localhost ~]# du -s 6000 .
常用方式
du -ch #查詢當前目錄下所有文件夾占用磁盤的大小
[root@localhost ~]# du -ch 4.1M ./bin 5.9M . 5.9M 總用量
du -ch * #查詢當前目錄下不隱藏的文件夾與文件占用磁盤的大小
[root@localhost ~]# du -ch * 4.0K anaconda-ks.cfg 4.1M bin 32K install.log 12K install.log.syslog 1.7M nload_bin.tar.gz 5.9M 總用量
du -ch .[!.]* #查看當前目錄下隱藏文件占用磁盤的大小
[root@localhost ~]# du -ch .[!.]* 8.0K .bash_history 4.0K .bash_logout 4.0K .bash_profile 4.0K .bashrc 4.0K .cshrc 0 .my.cnf 4.0K .mysql_history 4.0K .nload 4.0K .tcshrc 8.0K .viminfo 4.0K .Xauthority 48K 總用量
