47

linux如何查看文件和目录大小

 5 years ago
source link: https://www.linuxprobe.com/linux-file-look.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

起因工作中或者日常使用ubuntu时候,经常会遇到查看当前系统容量的情况,这时候就需要我们使用命令来查询当前目录或者文件的大小了 目录的容量(du)语法格式[plain] du [-ahskm] 文件或者目录名

参数解释-a : 列出所有的文件与目录容量,因为默认仅统计目录的容量而已

-h: 以人们较易读的容量格式呈现(G/M/K)显示,自动选择显示的单位大小

-s : 列出总量而已,而不列出每个个别的目录占用容量

-k : 以KB为单位进行显示

-m : 以MB为单位进行显示常用命令参考 查看当前目录大小[plain] du -sh ./

查看某一指定目录大小[plain] du -sh directory_name 在指定目录下显示10个占用空间最大(最小)的目录或文件最大:[plain] du -sh * | sort -nr | head 最小:[php] du -sh * | sort -n | head


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK