How to Find Files Accessed Recently in Ubuntu Linux

The Access Audit

In Ubuntu Linux, the kernel tracks three different timestamps for every file on your hard drive: when it was created, when it was last modified, and when it was last accessed (read). If you are trying to free up space on a crowded file server, you don’t necessarily care when a massive video file was created; you care if anyone has actually watched it recently. If a directory contains 500 gigabytes of data that hasn’t been opened by a single user in over a year, it can likely be safely archived or deleted. To find this stale data, you must search explicitly based on the last read time.

Using the find Command with -atime

The Linux find command utilizes the -atime (Accessed Time) flag to filter results based on when a file was last opened.

  1. Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
  2. To search the main document directory for files that have been accessed within the last 7 days, type the following command exactly:
    sudo find /home/user/Documents/ -type f -atime -7
  3. Press Enter.

Finding Stale Files

To find files that are completely abandoned, you reverse the search logic using the plus sign (+). For example, if you want to find files that have not been opened or read by anyone in over 365 days, you would type:

sudo find /home/user/Documents/ -type f -atime +365

This will instantly output a list of dead files, allowing you to confidently delete or compress them without disrupting active workflows.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.