Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I list directories by their access time in the sense that some new files/directories are created (say, directories containing the most recently created files).

share|improve this question
Run man ls for a full list of options including various sort possibilities. – Caleb Jun 10 '11 at 7:39
up vote 12 down vote accepted

There are a couple of options that you can combine.

The -c switch sorts by time modified [1]:

-c with -lt: sort by, and show, ctime (time of last modification of file status information) with -l: show ctime and sort by name otherwise:
sort by ctime

The -u and -t switches can also be used:

-t sort by modification time
-u with -lt: sort by, and show, access time with -l: show access time and sort by name otherwise: sort by access time

You could put it all together like so [2]:

ls -ltcr         # sort by and show change time, most recent last
ls -ltur         # sort by and show access time, most recent last
ls -ltr          # sort by date, most recent last

[1] http://unixhelp.ed.ac.uk/CGI/man-cgi?ls

[2] -r reverses the order

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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