find -size -1M深入研究

张开发
2026/4/16 14:01:22 15 分钟阅读

分享文章

find -size -1M深入研究
先看代码[rootserver tmp]# echo 14 aa.txt [rootserver tmp]# cat aa.txt 14 [rootserver tmp]# ls -hl total 4.0K -rw-r--r--. 1 root root 3 Apr 8 18:27 aa.txt [rootserver tmp]# find -size -1M -type f [rootserver tmp]# find -size -2M -type f ./aa.txt [rootserver tmp]# touch bb.txt [rootserver tmp]# cat bb.txt [rootserver tmp]# ls -hl total 4.0K -rw-r--r--. 1 root root 3 Apr 8 18:27 aa.txt -rw-r--r--. 1 root root 0 Apr 8 18:27 bb.txt [rootserver tmp]# find -size -1M -type f ./bb.txt [rootserver tmp]# find -size -2M -type f ./aa.txt ./bb.txt [rootserver tmp]#-size -1M → 块数 1 → 只有空文件-size -2M → 块数 2 → 空文件 所有≤1M 的文件aa.txt 3 字节有内容 → 占 1 块空文件 0 字节 → 占 0 块

更多文章