Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to use find but sort the results reverse chronologically as with ls -ltr. Is this possible through any combo of flags or pipelines?

share|improve this question
    
possible duplicate of List files larger than {size} sorted by date –  Gilles Jan 24 '12 at 23:57
add comment

1 Answer

up vote 4 down vote accepted

Use find's -printf command to output both the time (in a sortable way) and the file, then sort. If you use GNU find,

find . your-options -printf "%T+\t%p\n" | sort
share|improve this answer
    
sort -r for reverse order. –  stnly Jan 24 '12 at 15:12
1  
ls -t sorts newer to older, sort sorts older to newer. So ls -t's reverse order is sort's normal order. –  angus Jan 24 '12 at 15:19
add comment

Your Answer

 
discard

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.