Alias for directory listing sorted by time modified in reverse order

ls

When I need to find my recently used files, this command:

ls -lt

lists in ascending order (by time), when there are lots files, I need to scroll to
the top to see needed files, because won't fit in terminal screen.

After finding out that tac inverses the output, I use: ls -lt dir/ | tac
Is there more fun way of doing it, without using external scripts/utils?

Best Answer

The -r does the same thing for ls as tac does for any command which needs reverse file ordering.

So you could just write

ls -ltr

From man page:

  • -l List in long format. If the output is to a terminal, a total sum for all the file sizes is output on a line before the long listing.
  • -r Reverse the order of the sort to get reverse lexicographical order or the oldest entries first (or largest files last, if combined with sort by size.
  • -t Sort by time modified (most recently modified first) before sorting the operands by lexicographical order.
Related Question