Linux Certification

sort and find a directory size

by lpilinuxblog on Dec.22, 2009, under About LPI

“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/Bookmark

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...