- lsof:list open files,
- sudo lsof | grep deleted:则列出虽然被删除,但还处于打开状态的文件。注意,这些文件占用的空间,只有在这些文件关闭时,才会被释放。
- md5sum:获得文件的 md5,以检查下载的文件是否正确;
- sha256sum:
1. 命令组合
How to Find Out Top Directories and Files (Disk Space) in Linux
- du command: Estimate file space usage.
- -h : Print sizes in human readable format (e.g., 10MB).
- -S : Do not include size of subdirectories.
- -s : Display only a total for each argument sort command : sort lines of text files.
- -r : Reverse the result of comparisons.
-h : Compare human readable numbers (e.g., 2K, 1G).
head : Output the first part of files.找出 Linux 系统中某目录下前 5 大目录
# du -a /home | sort -n -r | head -n 5
当前目录下占磁盘空间最大的目录
# du -a | sort -n -r | head -n 5
更好地可读性:
# du -hs * | sort -rh | head -5