Identify Files and Directories Eating All Your Disk Space
Kent Johnson over at SquareBits has enlightened us on three useful commands to find out which files and directories are the largest on your Linux system. These commands are helpful to have when your hard drive becomes full and your wondering if there are files that are taking up space that actually shouldn’t be. Make sure you read the end note and understand that these commands are resources hogs and should not be executed on a production machine that can not handle an increase in load.
Show the 50 largest files:
find / -path '/proc' -prune -o -size +1000k -printf '%s %p\n' | sort -k1 -g -r | head -50Show the 50 largest directories (excluding files in sub directories):
du -kS / | sort -k1 -g -r | fgrep -v '/proc' | head -50Show the 50 largest directories (including files in sub directories):
du -k / | sort -k1 -g -r | fgrep -v '/proc' | head -50
Popularity: 13% [?]
Tagged with: command line • HowTo • Linux • tips
Filed under: Linux
Like this post? Subscribe to my RSS feed and get loads more!













Exactly what I needed… It’s tough to figure out what’s eating your space… Worked out perfectly.
also for cross platform this sukcer cant be beat:
A very nice graphical Pie breakdown of all your files. yes free.
JDiskReport:
http://www.jgoodies.com/freeware/jdiskreport/index.html
Check out Baobab as well. It scans your filesystem (or a given directory) and has a tree of sizes on the left, and an onion-style chart on the right – the center is root, then each level outwards of the onion is a level deeper in the directories.
I know Ubuntu has it in their repositories.