‘ncdu’ Groups Files and Folders by their Disk Space Usage (Ubuntu)

‘ncdu’ is a ‘NCurses’ based utility that groups files and folders by their disk space usage in Ubuntu. Now Ubuntu comes with a very similar tool called ‘Baobab’, which of course is a graphical tool.

But after installing and using ‘ncdu’ for a while, though it is a command-line base tool, I find navigating into files and folders that are located in sub-directories (‘deep down’) to be far more easier in ‘ncdu’ than in ‘Baobab’. And also, ‘Baobab’ does not let you see individual files inside a folder, but ‘ncdu’ even shows you that too! (including their name, size, the size on the disk and the file path).

And not just that, it lets you do a lot other things such as:

*. Deleting files and folders.

*. Enable/Disable showing hidden files and toggle between showing disk usage in percentage, graph, both or none.


*. Sort files or folders first.

*. Sort the content by name or size.

*. Lets you ‘refresh’ the content manually (it automatically refreshes the content once every 10 seconds).

*. By default it loads the ‘Home’ folder of the current user. But you can make it to load any mount point that you like.

*. On the bottom status bar you can see details such as the Total disk usage, ‘Apparent size’ (= the actual size of the file. A file might occupy more space on a file system while storing due to many reasons thus the size on the disk and its actual size might not always match) and the total items on that location.

And what makes it handy is its this ability to let you control all of its functions by using single keyboard shortcuts.

For example, for navigating back and forth inside mount point, you can use the right and left ‘arrow keys’. Or for going up and down, use the up and down ‘arrow keys’. And because of this, as mentioned above, you can navigate into a folder or a file that is deep down inside in your file system really fast.

It is also very lightweight too, other than while calculating the size and scanning, it only takes about 600KiB to run.

You can install ‘ncdu’ in Ubuntu 12.10 Quantal Quetzal, 12.04 Precise Pangolin, 11.10, 11.04, 10.10 and 10.04 by using the below command on your Terminal window.

sudo apt-get install ncdu

Once installed, put the below command on the Terminal to open it.


That’s it!.

Few tips …

1. If you want to ‘ncdu’ to open a different mount point or any location, then use it in the below format.

ncdu /your-mount-point

Replace ‘your-mount-point‘ with the location that you want to browse.

2. Once selected a file, for getting few additional information about that file, press the ‘i’ key and it will open a small window as shown below. To get rid of that window, press the ‘i’ key again.


3. To reload (refresh) the content of the current directory, press the ‘r’ key.

4. To quit simply press the ‘q’ key.

5. It has few other shortcuts that are very handy. To know them please refer to its manual by using the below command.

man ncdu

That’s it. Kudos to ‘Yoran’ (the developer) for creating it!.

An RHCE, 'Linux' user with 14+ years of experience. Extreme lover of Linux and FOSS. He is passionate to test every Linux distribution & compare with the previous release to write in-depth articles to help the FOSS community.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.