Installing and Using NCDU (NCurses Disk Usage)

Last Updated on: 

ncdu is a curses-based version of the well-known ‘du‘ command and provides a fast way to see what directories are using your disk space.

What I love about this utility is that it can traverse the results without having to run the command over and over in different directories. The way it works is you execute the command once and then you can navigate the results, go into multiple sub-directories, and vice versa.

Let’s install ncdu:

Once it is installed, run ncdu in your terminal, it doesn’t matter where you are on your diectory.

Note: The du command is only able to scan directories that its calling user has permission to scan. So, you might want to scan using root to get the full sizes.

Also, it will scan every directory from its starting point onward.

Scanning the  home directory:

Output:

					

--- /home/pascal -------------------------------------------------------------------------------
   32.0 KiB [##########] /.siege
   16.0 KiB [#####     ]  .bash_history
   16.0 KiB [#####     ] /.ssh
   12.0 KiB [###       ] /.local
   12.0 KiB [###       ] /.config
    8.0 KiB [##        ] /.gnupg
    8.0 KiB [##        ] /mynotes
e   4.0 KiB [#         ] /backup
    4.0 KiB [#         ] /.cache
    4.0 KiB [#         ]  .bashrc
    4.0 KiB [#         ]  cars.sql
    4.0 KiB [#         ]  wget-log
    4.0 KiB [#         ]  .rnd
    4.0 KiB [#         ]  .note-1.swp
    4.0 KiB [#         ]  .profile
    4.0 KiB [#         ]  .mysql_history
    4.0 KiB [#         ]  .bash_logout
    4.0 KiB [#         ]  .wget-hsts
    4.0 KiB [#         ]  .selected_editor
    4.0 KiB [#         ]  .lesshst
    4.0 KiB [#         ]  note-2
    4.0 KiB [#         ]  note-1
@   0.0   B [          ]  notes
    0.0   B [          ]  .sudo_as_admin_successful

As you can see the result above, it gave us a menu-driven layout allowing you to browse through.

At the top is my current directory, use the up and down arrows to move your selection. If you press Enter on a directory, ncdu switches to showing you the summary of that directory, and you can continue to go down as far as you want.

To delete a file or folder, you simply press the d, use the q to quit.

Comment policy: Respectful and beneficial comments are welcome with full open hands. However, all comments are manually moderated and those that doesn't relate with what the passage is saying or offensive comments would be deleted. Thanks for understanding!

Leave a Reply

Your email address will not be published. Required fields are marked *

css.php