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 -50
Show the 50 largest directories (excluding files in sub directories):
du -kS / | sort -k1 -g -r | fgrep -v '/proc' | head -50
Show the 50 largest directories (including files in sub directories):
du -k / | sort -k1 -g -r | fgrep -v '/proc' | head -50
Popularity: 13% [?]
Filed under: Linux
Like this post? Subscribe to my RSS feed and get loads more!