首页/系统/Linux 运维命令速查/find 按大小筛选(-size/-empty)
文件与目录76 条

find 按大小筛选(-size/-empty)

-size 按块或单位筛选大小(c/k/M/G),-empty 直接找空文件与空目录;磁盘清理的常用组合。

Linux 运维命令速查系统更新于 2026-10-12
用途按文件大小筛选
语法find 路径 -size [+|-]N[ckMG]
单位c 字节 k K M G(默认为 512B 块)

常用示例

常用示例
find /data -type f -size +500M
find . -type f -size -10k -name '*.tmp'
find /data -type f -size +1G -exec ls -lh {} +
find /var/tmp -type f -empty
-size 按块向上取整比较:找精确字节数不实用,找区间(+100M、-1M)才是正确用法。

易错点

  • -size 1M 表示「恰好向上取整为 1M 块」,非「约 1M」;范围查询请用 + / - 前缀
  • 稀疏文件按表观大小参与比较,du 与 find -size 结果可能不同

数据来源与参考

  • man 1 find(GNU findutils 手册)

相关工具

​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌