HomePhab.xyz
定位问题时频繁使用 Linux 命令汇总

检查某文件或目录占用磁盘空间情况

The lowly du command has a lot to offer space-exploring sysadmins looking to understand their Linux system storage.

image.png (600×1 px, 472 KB)

"Duh Drive Street Sign" by Mike Moran is licensed under CC BY 2.0

du -ah –max-depth=1 /problem/path/
du -sh ./  # --summarize

# shows the time of the last modification to any file 
du -ah --time

常用选项说明:

  • -a : 是否递归显示子目录及其文件占用磁盘空间大小
  • -c:显示几个目录或文件占用的磁盘空间大小,或统计总和(total)
  • -apparent-size: 显示文件或目录自身大小,而不是它们占用的磁盘空间大小。
Written by Lone on Sat, Oct 2, 11:31 PM.
User
Projects
None
Subscribers
None

Event Timeline