du命令-查看占用磁盘空间大的文件夹与文件

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     总用量
posted @ 2018-11-06 13:42  至死不渝的爱  阅读(3948)  评论(0编辑  收藏  举报