ncdu (NCurses Disk Usage) is an efficient and intuitive tool for analyzing disk space usage through the terminal. Unlike the traditional du command, ncdu offers a convenient text-based interface that simplifies navigation through directories, allows quick sorting of folders by occupied space, and visually highlights the "heaviest" files and directories.
This makes it easy and fast to identify where the main disk space consumption is concentrated on your server or computer. It is especially useful when you need to free up disk space, find large directories, or perform storage audits. Thanks to its lightweight and fast operation, ncdu is ideal for system administrators, developers, and users who need to manage disk resources efficiently without extra effort or using bulky graphical programs.
In this article, we will cover how to install and use ncdu on Ubuntu 22.04.
Step 1: Update the package list
Before installation, it is recommended to update the package information on your system. To do this, run:
Step 2: Install ncdu
ncdu installation is done from Ubuntu’s standard repositories. Just run:
The -y flag automatically confirms the installation.
Step 3: Run ncdu to analyze the disk
To analyze disk space usage in the current directory, simply run:
If you want to check, for example, the root directory /, use:
Using sudo allows you to gain permissions to view all files and folders.
Main features and controls
- Navigation: up/down arrows — move through the list of directories and files.
- Enter directory: Enter key.
- Exit directory: Backspace key.
- Delete file or folder: d key (be careful!).
- Exit program: q key.
All in all
ncdu is an excellent tool for quick analysis and cleanup of disk space on a server or local machine running Ubuntu 22.04. Its simplicity and clarity make it an indispensable helper for system administrators and regular users alike.
Try installing and using ncdu to better understand what occupies space on your disk and manage your data storage more effectively.