成为我能成为的人 linux 常用命令

在路上 · 2020年01月14日 · 最后由 在路上 回复于 2020年01月15日 · 1919 次阅读

删除 90 天之前的所有文件:

find ./ -mtime +90 | xargs rm -rf

查找大小在某个区间的文件:
查找大小在某个范围内的文件使用-size 参数,-size +n 表示大于 n 单位的范围,-size –n 表示小于 n 单位的范围。例如,查找大于 100k 且小于 400k 的文件

find . -type f -mtime -1 -size +100k -size -400k | xargs ls -al

-type f 表示只查找文件,过滤掉文件夹,块文件等.
size 参数说明:
-sizen[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 Kilobytes (units of 1024 bytes)
M'    for Megabytes (units of 1048576 bytes)
G'    for Gigabytes (units of 1073741824 bytes)

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
共收到 2 条回复 时间 点赞

rm -rf. 酸爽的命令

simple 回复

😭

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册