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/”ezlinuxadmin.com

Share
This entry was posted in About LPI. Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>