ls command

Print the Newest File in a Given Directory and Other Directory Listing Examples

Linux directory listing command ls is another must.

This command lists files oldest to newest piped to grep which excludes directories piped to awk which returns the last line, which is the newest file. It only returns the file name.

If you wanted see all of the files and directories sorted oldest to newest this would do it.

If you wanted see all of the files and directories sorted newest to oldest.