Check disk space usage on linux with Ncdu
Ncdu (NCurses Disk Usage) is a command line tool to view and analyse disk space usage on linux. It can drill down into directories and report space used by individual directories. This way it is very easy to track down space consuming files/directories. It actually allows the user to do this much faster than even a gui file manager. On the server ofcourse gui tools are not present.
In this post i will explain installation process and example using ncdu applications on a Debian/Ubuntu, CentOS, Fedora linux.
Install ncdu on Debian/Ubuntu linux
ncdu is available by default in Ubuntu, Linux Mint and Debian repository.
# sudo apt-get install ncdu -y
# sudo aptitude ncdu -y
Install ncdu on RHEL/CentOS and Fedora linux
In order to install ncdu, you will first need to enable the EPEL repo. Once the EPEL repo is installed, ncdu can be installed with following command:
# yum install ncdu -y
Ncdu sample usage
To start ncdu type following command on your terminal:
After scanning completes you will se ncdu tree structure of files and folders width disk usage.
If you see to selected directory information press “i” button:
To see help window with ncdu available options press “Shift+?” key combination.
To exit to ncdu interface press “q” button.
So ncdu is a powerful tool to monitor, check and analyse disk space usage on your linux system. To monitor other resources like cpu, ram, disk io etc use htop, iotop and the likes.