CoolComputing Logo
Coupons/Deals  ·  New Promo Codes/Coupons  · October 16, 2018

How to sort by file size using ls

Posted on Friday, March 30, 2001 @ 01:46:48 AM CST by David Yee [] [read 14988 times]

Tips: Linux/Unix world
Note that the newer versions of "ls" can indeed sort by file size- for instance:

ls -alSr

will reverse sort the file size for the directory (smallest file to the largest file).

Please rate this article or post a brief review of How to sort by file size using ls or comment on benchmark/performance, features, availability, price or anything else regarding How to sort by file size using ls. Thanks!

How To Sort By File Size Using Ls Rating: 1.7/5 (11 votes cast)

Your Name:
I have read and agreed to the Review Posting Agreement.
Review Title:
dateComment #Article Comments
2002-08-27 15:52:3353Doing a:

du --max-depth=1 | sort -nr | less

Will prevent du from displaying the sizes of subdirectories.

2001-07-01 22:33:1527BTW, if you want to see which directories are taking up the most space, type the following in the directory that has the subdirectories you're curious about:

du | sort -nr | less

Note that if you have a lot of files this may take a little while to execute.