- Posted on
- • Software
ncdu: Disk usage analyzer with a text interface
- Author
-
-
- User
- Linux Bash
- Posts by this author
- Posts by this author
-
Ncdu: A Handy Disk Usage Analyzer with a Text Interface
When managing storage on your Linux systems, efficiently tracking your disk usage is vital. Visual tools like the graphical Disk Usage Analyzer
(part of the GNOME desktop environment) are helpful, but what if you're managing a server via SSH, or prefer using the terminal? Enter ncdu
(NCurses Disk Usage), a lightweight, text-based utility that provides a fast and easy-to-navigate interface to analyze disk usage. In this blog, we’ll explore what makes ncdu
special, and provide detailed installation instructions across different Linux distributions.
Why Choose ncdu?
Disk space management might look straightforward — until you're sifting through gigabytes of data trying to figure out what's using up all your storage. ncdu
offers several benefits:
Speed:
ncdu
scans your disk quicker than running a plaindu
command.Interactivity: Navigate through directories in its text-based user interface to see storage usage.
Usability: Easy to use, even for those new to the command line.
Availability:
ncdu
can be installed on almost any Linux distribution.
Key Features of ncdu
Simple Navigation: Use arrow keys to navigate through directories.
Delete Files: You can directly delete files and directories from within
ncdu
, making disk cleanup efficient.Sorting Options: Sort by name, size, or item count.
Export / Import: Scan results can be exported and later re-imported for analysis, saving time on rescans.
Installing ncdu
Installation of ncdu
varies slightly depending on your Linux distribution. Below, we provide specific commands for popular package managers including apt
for Debian-based systems, dnf
for Fedora, and zypper
for openSUSE.
Debian, Ubuntu, and derivatives:
For systems using the apt
package manager (like Debian and Ubuntu), use the following commands to update your package list and install ncdu
:
sudo apt update
sudo apt install ncdu
Fedora and derivatives:
If you're on Fedora or a similar system that uses dnf
, you can install ncdu
using:
sudo dnf install ncdu
openSUSE:
Users on openSUSE or SUSE Linux Enterprise can use the zypper
package manager to install ncdu
:
sudo zypper install ncdu
Using ncdu
After installation, using ncdu
is straightforward. Simply type ncdu
in your terminal. By default, it will scan the directory you're currently in. To scan a specific directory (for example, /home
), you can run:
ncdu /home
Navigate through the scan results using the arrow keys. Additional commands are displayed at the bottom of the interface, allowing you to sort results, delete items, or rescan directories.
Conclusion
ncdu
is a powerful tool that simplifies the task of tracking disk usage from the terminal. It’s perfect for server environments, users who prefer the command line, or those seeking a lightweight alternative to graphical applications. With easy installation and a user-friendly interface, ncdu
helps keep your disk usage in check, ensuring that your Linux system runs smoothly.
Happy cleaning, and remember, regular monitoring of disk usage is a great habit to keep your system in optimal condition!
Feel free to explore ncdu
and discover other functionalities it offers, such as tuning the scan with different flags and exporting scan data for reports. Whether you're a system administrator, a developer, or just a Linux enthusiast, ncdu
is an excellent addition to your toolkit.