Server Fault is a question and answer site for system and network administrators. 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 can I sort the results of find? I want to sort by date created asc?

find /docs -type f | sort

Sorts by filename not date created. Thanks.

share|improve this question
up vote 6 down vote accepted

AFAIK, Linux doesn't record the creation time, so the short answer is you cannot.

For the modification time, try this:

$ find /docs -type f -printf '%T@ %p\n' | sort -k1 -n


$ find /docs -type f -print0 | xargs -0 stat -c "%y %n" | sort
share|improve this answer
You beat me too it! Justin, for some discussion on what ctime actually means, look at – cjc Nov 28 '11 at 10:36
I'm getting: stat: illegal option -- c usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...] – Justin Nov 28 '11 at 11:50
Which distro are you using? – quanta Nov 28 '11 at 14:51

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.