Get most recent file in a directory on Linux

ls -Art | tail -n 1

Not very elegant, but it works.

Used flags:

-A list all files except . and ..

-r reverse order while sorting

-t sort by time, newest first

Leave a Comment