1、查看根目录下所有目录的大小:
du -sh /*
2、查看磁盘剩余空间
df -hl
3、使用find命令找到大于指定大小的文件:
find / -type f -size +10G
将输出:
/usr/local/apache2/logs/access_log
马上可以通过du命令查看此文件的大小:
du -h /usr/local/apache2/logs/access_log
4、让文件夹下的文件让文件按大小排序?
方法一:长格式显示
ls -lhSl
h human readable模式:大小单位为M,G等易读格式
S size按大小排序。
方法二:
du -h * | sort -n
5、查看文件夹内最大的几个文件或最小的几个文件
du -h * | sort -n|head
du -h * | sort -n|tail
6、查看某个文件或目录占用磁盘空间的大小
du -ah --max-depth=
参考:
https://blog.csdn.net/weixin_34561824/article/details/116774519?utm_medium=distribute.pc_relevant.none-task-blog-2defaultbaidujs_baidulandingword~default-5-116774519-blog-116641358.t5_layer_eslanding_sa_randoms&spm=1001.2101.3001.4242.4&utm_relevant_index=8
http://www.yayihouse.com/yayishuwu/chapter/2395