NCDU – Find what’s using all your disk space on linux based system
NCDU is a text-based user interface, it allows you to visually see how and where disk space is being used via an easy-to-use interface. Simple run the command in the current directory to see a directory tree of folders & files and their space usage.
I use this tool mainly for analysing why a server is running out of disk space, determine the reason why and if it’s simply expanded the disk space or is there unused files / massive logs which can be purged.
Install
Run the required command for your linux OS version.
sudo apt install ncdu
sudo yum install ndcu
How to use
Simple navigate to a directory you want to check and run the command:
ncdu
If you want to scan the whole system go to the root directory:
cd /
ncdu
You can also specify a directory if you don’t want to change directory:
ncdu /home
Windows Server / PC
For windows-based machines I use a bit of software called TreeSize, it does the same thing as NCDU, allowing you to see how your disk space is being used on a windows based OS.
This is provided as it and may require changes to work for your needs.