Answers:
用途find:
find /path -mtime +180 -size +1G
-mtime表示搜索的修改时间大于180天(+180)。并且该-size参数搜索大于1GB的文件。
find: a.txt :Permission denied建议您添加2>/dev/null此注释,它的 灵感来自以下注释:unix.stackexchange.com/questions/42841/…–
xargs ls -lhS按大小排序: find /path -mtime +180 -size +1G | xargs ls -lhS
find / -size +1G -mtime +180 -print0 2>/dev/null | xargs -0 ls -lhS。新手注意:的重定向2>/dev/null消除了permission denied从根目录搜索时不可避免出现的错误。要按上次修改日期排序,请ls -lht改用并添加r到ls命令中,例如ls -lhSr,将结果反转(最小到最大/最旧到最新)。
find该G后缀的实现中,它表示GiB(1073741824字节),而不是GB(1000000000)。可移植的,你会使用find /path -mtime +180 -size +1073741824c