pl_*_*ock 10
使用像:
find /var/log -type f -size -10M -size +1M -exec ls {} \; > result.txt
Run Code Online (Sandbox Code Playgroud)
它将存储大小大于 1Mb 且小于 10Mb 的文件名。
cat result.txt
/var/log/wtmp
/var/log/audit/audit.log.1
/var/log/audit/audit.log
/var/log/anaconda/journal.log
/var/log/mongo/mongod-11.0.0.11.log
Run Code Online (Sandbox Code Playgroud)
如果您作为输入参数传递,则使用如下:
find /var/log -type f -size -"$1"M -size +"$2"M -exec ls {} \; > result.txt
Run Code Online (Sandbox Code Playgroud)
以下是可用的尺寸单位。
-size n[cwbkMG]
File uses n units of space, rounding up. The following
suffixes can be used:
`b' for 512-byte blocks (this is the default if no suffix
is used)
`c' for bytes
`w' for two-byte words
`k' for Kibibytes (KiB, units of 1024 bytes)
`M' for Mebibytes (MiB, units of 1024 * 1024 = 1048576
bytes)
`G' for Gibibytes (GiB, units of 1024 * 1024 * 1024 =
1073741824 bytes)
Run Code Online (Sandbox Code Playgroud)