How to Sort files and folders by size

If you want to Sort your files and folders by size use the following tip
You need to open terminal use the following command

ls -lS –block-size=1 | awk ‘ {print $5,$6,$7,$8}’ >size.txt; du -s –block-size=1 */ >>size.txt; sort -n size.txt

or

{ ls -lS –block-size=1 | awk ‘ {print $5,$6,$7,$8}’; du -s –block-size=1 */ ; } | sort -nr | less

Comments

One Response to “How to Sort files and folders by size”

  1. ZeD on August 14th, 2007 2:36 pm

    Doesn’t work!

    do this: # du -sh * | sort -n

Leave a Reply

You must be logged in to post a comment.