繁体   English   中英

如何使用 linux find 命令列出特定分钟或天未访问的文件?

[英]How to list files that are not accessed for particular mins or days using linux find command?

我在 /praveen/sf 下创建了一个文件 t3 并使用下面的命令来查找未访问的文件(我实际上是在寻找 t3 文件)

$ find praveen -atime +1 -exec grep -iw -r 'vpc' {} \;

但是我没有得到任何 output,所以我使用了以下命令

$ find praveen -atime -1 -exec grep -iw -r 'vpc' {} \;

praveen/sf/t3:NACL referes to Network Access Control Lists, which is actually a security layer of our Virtual Private Cloud (VPC).
praveen/sf/t3:NACL referes to Network Access Control Lists, which is actually a security layer of our Virtual Private Cloud (VPC).
NACL referes to Network Access Control Lists, which is actually a security layer of our Virtual Private Cloud (VPC).

我读到-atime -1显示超过 1 天前访问的文件,而-atime +1显示 1 天前未访问的文件。

但是上面的命令并没有像我读过的那样抛出 output 。

请帮忙。

您对find-atime用法的理解不正确。 -atime -1显示最后一次访问不到 1 天(24 小时)前的文件, -atime +1显示最后一次访问超过 24 小时前的文件。 要查看当前目录中过去 24 小时内未访问的文件,可以运行以下find命令:

find . -type f -atime +1 | xargs ls -ld

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM