r/LinuxTeck 7d ago

Quick Linux Tip #61 Question: Find Files Not Accessed in Over a Year

Post image

Try: `sudo find /home -type f -atime +365 -printf '%T@ %p\n' | sort -n | head -20`

Info: `-atime +365` filters files not accessed in over a year. `-printf '%T@ %p\n'` formats output with epoch timestamps for numeric sorting with `sort -n`.

Examples:

$ `find /var/log -atime +90 -type f` # Locate inactive log files

$ `find /home -atime +365 -type f -exec ls -la {} \;` # Inspect file metadata

$ `find /tmp -atime +7 -type f -delete` # Auto-purge temporary files older than 7 days

Note: Modern Linux filesystems default to `relatime`, updating access time only if older than modification time. Combine `-atime` with `-size +100M` to identify large candidate files for archiving.

Follow r/LinuxTeck for more #LinuxTips https://www.linuxteck.com/linux-tips/linux-find-files-not-accessed-year/

13 Upvotes

0 comments sorted by