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.


Discover more from Hosting Mate

Subscribe to get the latest posts sent to your email.

Similar Posts