Find largest directories on linux. Analyse disk space usageBy neokrates, written on November 18, 2011
Where is all my linux disk space? What used all my disk space?
du command has many useful options to analyze the disk usage.
The following method allows to track down the “biggest offenders”, directories which take most space in, more then GB, then hundreds MB..
I used two additional options here :
-h = human readable, prints G or M sizes.
-x / says to stay on the same device, in this case root device.
You can skip
-x / if you analyze all mounted devices.
100 dirs with size over Gb:
> du -hx / |grep ^[0-9.]*G | sort -rn| head -n 100
10 dirs with size over Gb:
> du -hx / |grep ^[0-9.]*G | sort -rn| head -n 10
10 dirs with size over M:
> du -hx / |grep ^[0-9.]*M | sort -rn| head -n 10
This way, you can get a list of dirs, first more then Gb big, then largest Mb dirs.
Such list can be sorted, grepped, etc, to find the root cause of you hard disk problems …
Here are more commands to try :
INCOMING SEARCH TERMS