See folder size breakdown in Linux?
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
Or you can pass:
du -sm /dir1 /dir2 | sort -nrk 1
#or
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.