List files by time (in reverse order) and in human readable file size

This post tells you how to list files under a directory by time in reverser order and in human readable file size (works on Linux OS and Mac).

  • ls -ltrh 

list all the csv files under the current directory in long format by time and in reverse order, the file size in human readable format (e.g., in mb, or gb, instead of byte size)

  • -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.
  • ls -ltrh *.csv

list all the csv files under the current directory in long format by time and in reverse order, the file size in human readable format (e.g., in mb, or gb, instead of byte size)

 

For more commonly used Linux commands, check my other posts at here  and here .

Leave a Reply

Your email address will not be published. Required fields are marked *