Sort and find a directory size

The easiest and fastest way is:
du -sh *
But if you want to search recursively and display in order you need this one:
du -h --max-depth=1 /home/ | sort -n -r
And if you want even more depth try:
du -s ./* | sort -n| cut -f 2-|xargs -i du -sh {}
I recommend trying all three with a fairly small folder to see which one you like best, the progressively (as they go down) require more cpu and time to run.
Also if you want just to find a directory size try this:
du -h /usr/

Comments are closed.