To print the last field of last line $ ls -lrt | awk '{ f=$NF }; END{ print f }' This also works sometime $ ls -t1 | head -n1