Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

search for files not accessed for x days

Tags:

linux

bash

ubuntu

How can I find files in Linux that were not accessed for X days?

I found that command, but it will show files that were viewed for the last x days:

$ find /home/you -iname "*.pdf" -atime -60 -type -f
like image 447
rabotalius Avatar asked Apr 02 '13 13:04

rabotalius


People also ask

How do you find all the files modified in less than 3 days and save the record in a text file?

Use -mtime option with the find command to search files based on modification time followed by the number of days. Number of days can be used in two formats.

How do I find the last two days in Unix?

You can use -mtime option. It returns list of file if the file was last accessed N*24 hours ago. For example to find file in last 2 months (60 days) you need to use -mtime +60 option. -mtime +60 means you are looking for a file modified 60 days ago.


1 Answers

Use -atime +60 to see files that have not been accessed within the last 60 days:

find /home/you -iname "*.pdf" -atime +60 -type f
like image 169
dogbane Avatar answered Sep 30 '22 18:09

dogbane