SSH - du - Finding large files

du command to identify the largest folders


If you are running a server for multiple sites, you may find you are running out of disk space. One good way to find out what files are large is via ssh root access into your host.

ie using putty to ssh into your server:

du --max-depth=1 -h


This may take a while to run. When it's done, it will show you the size of every sub-directory of the current folder (max-depth=1) and print it in human readable format (-h).

Next, go to the largest sub-directory and run the command again. This is a quick way to find out what directories are racking up the disk space.

SSH Find command

find / -size +1000000k

Another good command is find. Run this in your root directory and it will locate all files over 1gb. If you have one insanely big log file - which can easily happen if something loops and starts throwing errors - it will locate it pretty quickly.

(copying some old posts from an old forum of mine that I wish to keep)