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
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With