Skip to content

Instantly share code, notes, and snippets.

@shui
Created March 5, 2018 03:24
Show Gist options
  • Save shui/12f777ba7b8f88f700e20fbf3d1fc7d2 to your computer and use it in GitHub Desktop.
Save shui/12f777ba7b8f88f700e20fbf3d1fc7d2 to your computer and use it in GitHub Desktop.
Linux查找大文件和大目录

挂载/home的磁盘目录扩容了好几次但很快又没可用空间了,很烦。 之后发现是Gitlab自动备份文件堆积成山……

  • 查找大文件
# 查找超过800M大小文件
find . -type f -size +800M
# 查找超过800M大小文件,并显示文件信息
find . -type f -size +800M -print0 | xargs -0 ls -l
# 查找超过800M大小文件,并显示查找出来文件的具体大小
find . -type f -size +800M  -print0 | xargs -0 du -h
# 查找超过800M大小文件,并显示查找出来文件的具体大小并排序
find . -type f -size +800M  -print0 | xargs -0 du -h | sort -nr
  • 查找大目录
du -h --max-depth=1

Ref:Linux如何查找大文件或目录总结

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment