Sometimes there are so many files in a directory that it’s hard to find the last file in the directory. We show you here 2 ways for finding it out.
With awk we print the last argument of the last line:
bash |copy code |?
1 $ ls -lrt | awk '{ f=$NF }; END{ print f }'
Reverse ordering with ls and then getting the first line:
bash |copy code |?
1 $ ls -t1 | head -n1