Return to Snippet

Revision: 10515
at January 3, 2009 09:25 by jaduks


Initial Code
way 1:

$ ls -lrt | awk '{ f=$NF }; END{ print f }'

The above awk is to print the last argument of the last line

way 2:

$ ls -t1 | head -n1

Initial URL
http://unstableme.blogspot.com/2008/06/find-latest-file-in-directorybash.html

Initial Description
To find the latest file in a particular dir

Initial Title
Find Latest file in a directory

Initial Tags
command, Bash

Initial Language
Bash