[Eug-lug] help with directory listing

Rob Hudson rob at cogit8.org
Tue Mar 4 15:46:16 PST 2008


I'll admit up front... I don't know my unix utility commands like I
should.  Thinks like sed, awk, cut, sort, uniq, etc can all make for
some powerful combinations.

My goal via a shell script: Get the filename of the most recently modified file.

I can do this:
> ls -t

to get the files sorted by modified time.  But can you do a "LIMIT 1"
a la SQL, or just get the first line?  Or reverse sort it to get the
last line?

Thanks,
Rob


More information about the EUGLUG mailing list