Unix/Linux find and sort by date modified

Posted by Richard Easton on Super User See other posts from Super User or by Richard Easton
Published on 2011-06-07T18:23:57Z Indexed on 2012/06/08 4:42 UTC
Read the original article Hit count: 1402

Filed under:
|
|
|

How can I do a simple find which would order the results by most recently modified?

Here is the current find I am using (I am doing a shell escape in PHP, so that is the reasoning for the variables):

find '$dir' -name '$str'\* -print | head -10

How could I have this order the search by most recently modified? (Note I do not want it to sort 'after' the search, but rather find the results based on what was most recently modified.)

© Super User or respective owner

Related posts about linux

Related posts about unix