Sort the files in the directory recursively based on last modified date

find -printf "%TY-%Tm-%Td %TT %p\n" | sort -n

will give you something like

2014-03-31 04:10:54.8596422640 ./foo
2014-04-01 01:02:11.9635521720 ./bar


If you want to flatten the directory structure (thus sorting by date over all files in all directories, ignoring what directory the files are in) the find-approach suggested by @yeti is the way to go. If you want to preserve directory structure, you might try

$ ls -ltR /path/to/directory

which sorts directory based.


In bash, run shopt -s globstar first. In ksh93, run set -o globstar first. In zsh, you're already set.

ls -dltr **/*

This will return an error if you have so many files that the command line length limit on your system is exceeded. In zsh, you can use this instead:

print -rl -- **/*(Om)