Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any command that could show me the size of several folders in linux, perhaps ranked from biggest to smallest?

share|improve this question
up vote 9 down vote accepted

As others said, du is the way to go. But knowing the options to du is essential. Here they are:

du -m --max-depth 1 /foo /bar

This will give you the size in megabytes of the directories contained in /foo and /bar. If you want the output to be sorted, pipe it through the sort utility:

du -m --max-depth 1 /foo /bar | sort -n -k 1
share|improve this answer

Or you can pass:

du -sm /dir1 /dir2 | sort -nrk 1
du -sm * | sort -nrk 1

The difference between the first and the second is that the sencond will pick all the files and dirs in the current directory and the first just the dirs you passed.

share|improve this answer
du -s and sort don't really like each other. – innaM Nov 11 '09 at 13:04
I have yet to run into some kind of problem with these lines in any of my commonly used distros: openSUSE, Arch & Ubuntu. I concour that without the -m switch it would just mess the whole thing. =p – Mereghost Nov 11 '09 at 13:33
Oh god! Sorry. I somehow mixed up -s and -h. Please disregard my comment. – innaM Nov 11 '09 at 13:52

du [options] [directories and/or files]

share|improve this answer

use du in terminal.

share|improve this answer
This is really a comment, not an answer to the question. Please use "add comment" to leave feedback for the author. – Diogo Aug 8 '12 at 23:12

From the command line I prefer to list the biggest last so I use:

du -shm ./* | sort -n
share|improve this answer

If you would like a graphical (X11) display, consider installing xdiskusage. You can either pipe the output of du into it (as you might do if you're running du as another user, or on another system, or at another time), or you can run it interactively and it will invoke du for itself.

As usual, once it's installed, consult the man page.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .