The ls
program accepts a -t
flag to sort files by their last modified date (most recently modified first)
Example:
$ ls -lt
-rw-r--r-- 1 dillon staff 224 Dec 3 2016 newest.rb
-rw-r--r-- 1 dillon staff 192 Nov 16 2016 middle.rb
-rw-r--r-- 1 dillon staff 512 Nov 8 2016 oldest.rb