It's important to keep an eye on disk usage within your hosting account(s), since shortages can cause havoc with email, caching, backup storage and other functions.
There are multiple ways of finding disk usage, including terminal prompt and within WHM/cPanel.
Get an overview of disk usage by logging into cPanel and clicking Files, Disk Usage.
Find what's using the most space if you sort by usage then expand the folder(s) with the largest usage. From within the expanded folder view, you'll be able to see subfolders and specific files that are taking up all the space.
Login to the server via SSH and run the below command which will give you a list of the 50 largest files and directories occupying space on the hosting server, within the specified /path.
du -amx /path | sort -rn | head -50
The du command is amazingly powerful and has options to make the output more helpful, including….
-h for human readable output -a for all
Just running the du command and piping the output to sort by size can give you superb information about usage:
du -hs * | sort -h
For many ways of cleaning up your server account and reducing disk usage, check out our two part blog post on producing cleaner code. We cover everything from streamlining logging, purging logs, stats and temp files to cleaning out spam, trash and much more.