Find Directories Using Lots of Disk Space in Windows or Linux

I often run into a system where one of the file systems has ran out of disk space. Usually this is because some application is producing errors and writing massive log files. Sometimes users will fill up their home directory with random large files they created or downloaded. Either way in order to fix the problem you need to know which directory is filling up the disk.

In windows the best method I’ve found to find large files or directories is a program called WinDirStat.  (Download Here)

WinDirStat will scan the drive you select (or all local drives if you want) and display a graphical representation of the largest files and directories on the system.  The columns are also sortable by their sub fields. You can click on the large blocks displayed to see which file it represents and easily delete it if you like.

WinDirStat

  

On a Linux system you can use a program called Du to locate the problem.

du -x / | sort -rn | less

What exactly does this command do?

du -x

Du summarizes disk usage recursively, the -x option tells it to skip directories on different file systems.

sort -rn

Sorts the numeric output in reverse (highest to lowest)

less

Displays the output one page at a time.  I like using less instead of more since it allows you to go back instead of just forward.

Sam Kear

Sam graduated from the University of Missouri - Kansas City with a bachelors degree in Information Technology. Currently he works as a network analyst for an algorithmic trading firm. Sam enjoys the challenge of troubleshooting complex problems and is constantly experimenting with new technologies.

Leave a Reply

Your email address will not be published. Required fields are marked *