简体   繁体   English

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

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

I created a file t3 under /praveen/sf and used below command to find the files that are not accessed (i am actually looking for t3 file)我在 /praveen/sf 下创建了一个文件 t3 并使用下面的命令来查找未访问的文件(我实际上是在寻找 t3 文件)

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

But I did not get any output, so I used below command但是我没有得到任何 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).

And I read like -atime -1 displays files which are accessed by more than 1 day ago and -atime +1 displays files which are not accessed 1 day ago.我读到-atime -1显示超过 1 天前访问的文件,而-atime +1显示 1 天前未访问的文件。

But the above commands did not throw output as I had read.但是上面的命令并没有像我读过的那样抛出 output 。

Please help.请帮忙。

Your understanding of find 's -atime usage is not correct.您对find-atime用法的理解不正确。 -atime -1 displays files which were last accessed less than 1 day (24 hours) ago, and -atime +1 displays files which were last accessed more than 24 hours ago. -atime -1显示最后一次访问不到 1 天(24 小时)前的文件, -atime +1显示最后一次访问超过 24 小时前的文件。 To see files NOT accessed within the last 24 hours in the current dir, you can run this find command:要查看当前目录中过去 24 小时内未访问的文件,可以运行以下find命令:

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

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

相关问题 查找过去 x 天内未访问的文件 - Find files that were not accessed in the last x days 如何使用rsync命令在linux中复制当前日期文件或特定日期文件? - how to copy current date files or particular date files in linux using rsync command? 用于查找该目录中留下过去 7 天内创建的文件的空间的命令。 不使用`find` - Command to find how much is the space in that directory leaving the files created in last 7 days. Without using `find` 如何使用 Linux 命令行仅在 .csv 文件中搜索特定单词? - How to search for a particular word in only .csv files using Linux command line? Linux 命令:如何仅“查找”文本文件? - Linux command: How to 'find' only text files? Windows等同于查找最近90天内访问的文件 - Windows equivalent to find files accessed in the last 90 days 如何在 Linux 上的指定目录中查找使用特定标头的所有文件? - How to find all the files that use a particular header in a specified directory on Linux? 如何在linux中查找具有特定父目录的所有文件? - How to find all files with a particular parent directory in linux? 使用 Linux 上的 find 命令查找和删除带空格的文件 - find and remove files with space using find command on Linux 如何从Linux ls的文件列表中grep内容或find命令 - How to grep contents from list of files from Linux ls or find command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM