Some handy ls and find tricks with dates

Posted by acidjunk on September 3, 2014

As a quick reminder for myself; some ls and find variations to do stuff with files and dates.

ls sort on date:

ls -t

ls reverse sort on date:

ls -tr

ls reverse sort on modifed date, show hidden files, showdetails and print it in human readable form

ls -alhtr

find all files in current dirs and subdirs (e.g. recursively) that are changed in the last 5 minutes:

find . -type f -mmin -5 -print0 | xargs -0 /bin/ls -ltr

Find all files on filesystem that were modified maximally 3 * 24 hours (3 days) ago till now:

find / -ctime 3