为什么需要这篇文章
我想大概是这种情况,你的Linux 机器下磁盘满了,需要清理,然后就需要查找大的文件,确定是否有用进行删除。
具体做法
查找500M以上的文件
1 | sudo find / -size +500M |
查找整整500M的文件
1 | sudo find / -size 500M |
查找小于500M的文件
1 | sudo find / -size -500M |
查找大于100M且小于500M的文件
1 | sudo find / -size -500M -size +100M |
其他查找单位
- b – for 512-byte blocks (this is the default if no suffix is used)
- c – for bytes
- w – for two-byte words
- k – for Kilobytes
- M – for Megabytes
- G – for Gigabytes
References
- https://www.ostechnix.com/find-files-bigger-smaller-x-size-linux/
- http://man7.org/linux/man-pages/man1/find.1.html