If you find your server seems to be running out of disk space, the first thing you should do is figure out how full your disk really is. After that, you'll need a way to quickly zero in on which files and folders are using up the most disk space unnecessarily.
If you're interested in check the disk usage of your server, you probably need to know a thing or two about dev ops. For that, I recommend reading The DevOps Handbook.
Scroll down to continue reading.
First, you should make sure that you actually are running out of space. The utility df is useful for seeing exactly how much space is available on each of your partitions. Run it with the "-h" option to get the results printed in "human-readable" units.
On Windows, you can use WinDirStat, and on Ubuntu Desktop, you can use Baobab to quickly find folders that are much larger than they should be.
WinDirStat and Baobab are two programs with graphical user interfaces that let you quickly find large files and folders. On Ubuntu server, you don't have the luxury of a graphical user interface. That's wher ncdu comes in. Ncdu is basically Baobab for the command line.
Installing and running ncdu is a breeze:
sudo apt install ncdu cd / ncdu
And navigation within ncdu is intuitive: just use the arrow keys and "enter". Make sure you launch ncdu while you're in "/" because you can only scan and navigate to directories under the present working directory. Once you've figured out what files are taking up too much space on your disk, press "q" to quit ncdu.
Have you had out of disk space issues on your server? What was the cause? Let me know in the comments!
Photo by Andrew Hart