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     总用量


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM