The-Unix-Shell-Teaching-Notes

2.2 Listing in Reverse Chronological Order

By default, ls lists the contents of a directory in alphabetical order by name. The command ls -t lists items by time of last change instead of alphabetically. The command ls -r lists the contents of a directory in reverse order. Which file is displayed last when you combine the -t and -roptions? Hint: You may need to use the -l option to see the last changed dates.

Solution The most recently changed file is listed last when using -rt. This can be very useful for finding your most recent edits or checking to see if a new output file was written.

Episode 2 Exercise 3