How can I list files according to the last time they were accessed?

So far I haven't seen a command that can list them by time.

I need it to display files that have been last accessed last December, if that helps any.

  • Hang on, do you really mean access or modification time? – terdon Jul 6 '13 at 14:24

I am not sure this is possible. In theory both ls and find are quite capable of sorting or finding by access time. The problem is that since kernel version 2.3.60, the default options for filesystem mounting include noatime:

          Do not update inode access  times  on  this  filesystem
          (e.g.,  for faster access on the news spool to speed up
          news servers).

If your disks are mounted using the default options, the access time will not be modified when a file is accessed so the information you need to find by access time will not be present on your system. See this question on U&L.SE for more information.

  • Looks like you're right, I pulled up an outdated VM to try it on. Thanks for the tip. – nerdwaller Apr 17 '13 at 17:50
  • 1
    @nerdwaller no worries, I was about to upvote you when I tested and saw id did not work. I was intrigued enough to go look up why :). – terdon Apr 17 '13 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.