[英]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.