Check disk space usage on linux with Ncdu

Photo of author

By rasho

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

or

# sudo aptitude ncdu -y

[ads1]

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:

# ncdu
NCDU Scanning directory
NCDU Scanning directory

After scanning completes you will se ncdu tree structure of files and folders width disk usage.

NCDU Disk Usage Tree View
NCDU Disk Usage Tree View

If you see to selected directory information press “i” button:

ncdu Directory Information
ncdu Directory Information

To see help window with ncdu available options press  “Shift+?key combination.
[ads1]

ncdu help screen
ncdu help screen

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.

See also:

[box type=”info” align=”” class=”” width=””]

[/box]

Leave a Comment