Ncdu – A Powerful NCurses-Based Disk Usage Analyzer for Linux

ncdu (NCurses Disk Usage) is a command-line version of the popular ‘du command, which is based on ncurses and offers the fastest way to analyze and track disk space usage in Linux.

Providing an excellent ncurses-based interface, it displays information more intuitively, with columns indicating disk space usage in megabytes and gigabytes, along with graphical bar usage, file/directory names, file deletion, refresh options, etc.

ncdu aims to be a simple, fast, and easy-to-use program that runs on any minimal Linux/Unix-based system with ncurses installed.

This article guides you through the process of installing and using the NCDU program on a Linux system.

This article explains the process of installing and using the ncdu (NCurses Disk Usage) program on a Linux system.

How to Install ncdu (NCurses Disk Usage) in Linux

The ‘ncdu‘ package is available in the package repositories of most Linux distributions and you can install ncdu using your package manager relevant to your distribution.

sudo apt install ncdu         [On Debian, Ubuntu and Mint]
sudo yum install ncdu         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
sudo emerge -a sys-apps/ncdu  [On Gentoo Linux]
sudo apk add ncdu             [On Alpine Linux]
sudo pacman -S ncdu           [On Arch Linux]
sudo zypper install ncdu      [On OpenSUSE]    
sudo pkg install ncdu         [On FreeBSD]

After installation, just type ‘ncdu‘ in the terminal to launch the program. It will then scan the number of files and directories, providing information on the disk usage of the current working directory.

ncdu
Analyzing Linux Disk Usage
Analyzing Linux Disk Usage

Once, scanning completes, it will present the tree structure of files and folders along with their disk usage in human-readable format with a graphical bar presentation.

Linux Disk Usage Tree View
Linux Disk Usage Tree View

Use the arrow keys to navigate through directories and press “i” to see the selected directory information like full path, disk usage, apparent size. Again, hit “i” to hide the window.

View Directory Information
View Directory Information

Now you can easily find and delete unnecessary files or folders to free up disk space by hitting -d to delete selected files or directories, before deleting it will prompt you for confirmation. Press “Yes” or “No“.

Delete Files in Linux
Delete Files in Linux

To get more information about ncdu help and options, press Shift+? and use the arrow keys to move up and down for more options.

Ncdu Command Usage
Ncdu Command Usage

Use “q” to quit interface. Here is a list of available options for ncdu, you can check them.

┌───ncdu help─────────────────1:Keys───2:Format───3:About─────┐
 │         						       │
 │   up, 	k  Move cursor up                              │
 │   down, 	j  Move cursor down                            │
 │   right/enter   Open selected directory                     │
 │   left, <, 	h  Open parent directory                       │
 │   	      	n  Sort by name (ascending/descending)         │
 │   		s  Sort by size (ascending/descending)         │
 │ 		d  Delete selected file or directory           │
 │  		t  Toggle dirs before files when sorting       │
 │  		g  Show percentage and/or graph                │
 │ 		a  Toggle between apparent size and disk usage │
 │		e  Show/hide hidden or excluded files          │
 │           	i  Show information about selected item        │
 │           	r  Recalculate the current directory           │
 │           	q  Quit ncdu                                   │
 │          	                                               │
 │                                     Press q to continue     │
 └─────────────────────────────────────────────────────────────┘
Conclusion

Ncdu is a powerful yet accessible tool for anyone looking to simplify disk usage analysis on a Linux system. Its user-friendly interface, clear visuals, and interactive features make it a valuable addition to your toolkit.

Whether you’re a seasoned Linux user or just starting, Ncdu provides a hassle-free way to stay on top of your system’s storage.

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

5 Comments

Leave a Reply
  1. Hi.. i moved a large file nearly 130Gb from one directory to another directory but i wondering the space is still the same.. Can you please let mw know why its been same

    Reply
    • @Wasim,
      Moving large size files from one directory to another will not reduce size, it still remains same size as you moving the data in the same server…

      Reply
  2. Is there any option u are aware of where we can disable the delete option. Coz my team mate accidently deleted some important data while browsing through ncdu output.

    Reply

Leave a Reply to Wasim Cancel reply

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.