Any system, be it Linux or not, requires proper disk management. As files grow in number and size, overtime can hinder the system from working. As such, it is crucial to monitor how and what you are storing on your device. Ncdu is one such tool that provides users with not only an overview but also facilitates in-depth viewing of the directories and files stored on the system. This article aims to provide users with the correct method to install Ncdu on their systems.
Table Of Contents
What Is Ncdu?
The name Ncdu is an acronym for “Ncurses Disk Usage” which refers to a curses-based alternative tool to the popular “du” command on Linux. It provides details on how and what files are taking space on your local storage. Programmed using C, the tool utilizes the ncurses interface to provide the required information to the user. As such, the tool is quite straightforward in what it offers and quick when it comes to disk utilization and scanning.
Since it is an alternative to “du” or the disk usage utility, it is very useful for estimating the file size and cleaning a hard drive. Just like du, it summarizes the disk usage for each file and directory, even going as far as to list the various sub-directories. However, du is very old now and wasn’t as interactive as Ncdu. It also has some GUI-like features, however, it is solely a text-based interface.
Install Ncdu on Linux In Simple Steps:
Before proceeding with the installation, we want to let our readers know that the Ncdu package is already available in most native Linux distro archives. Thus, installing is very simple as you just need to use the proper command and install it from the native repo.
However, we have tried to provide other solutions, in case a user is unable to install it directly from the native archive. These are:
Method 1. Install Ncdu on Linux with Static Binaries
Static or stable binary Ncdu packages are available online at the official Ncdu website. It is very convenient to use. All the user has to do is:
- First, go to the website (link provided above).
- Then, download the file for his system.
- Now go to the downloaded package and extract it.
- Finally, run it. There is no need for any further compilation or installation.
Method 2. Using Linux Native Package Repositories
As stated above, you can directly install Ncdu via native repositories using Terminal. Boot up the Terminal using Ctrl+Alt+T and then:
On Debian and Ubuntu
Step 1. Update the APT repository:
sudo apt update
Step 2. Now install Ncdu.
sudo apt install ncdu
Or, you can also use the APT-Get command:
Step 1. Open the terminal to run the APT GET command:
sudo apt-get update
sudo apt-get -y install ncdu
On CentOS
Step 1. Update the YUM repository.
sudo yum check-update
Step 2. Install Ncdu.
sudo yum install ncdu
Or, you can install Ncdu using the DNF repository:
Step 1. You can use the DNF repository by updating it and then installing Ncdu.
sudo dnf check-update
sudo dnf install ncdu
On RHEL and Fedora
Step 1. Start by installing “yum-utils” if not present
sudo yum install yum-utils
Step 2. Then, enable the EPEL repo:
sudo yum install epel-<VERSION>
Step 3. Finally, install Ncdu:
sudo yum install ncdu
OR (Only for Fedora)
Step 1. You can also use the DNF command (just like the previous method)
sudo dnf update
sudo dnf install ncdu
On AlmaLinux
Step 1. Simply install Ncdu by using the following command:
sudo yum install ncdu
On Arch Linux
Step 1. You will need the Pacman command for Arch Linux:
sudo pacman -Sy
sudo pacman -S ncdu
On Alpine Linux
Similarly, on Alpine Linux, you can use the APK ADD command for installing Ncdu:
apk add ncdu ncdu-doc
On OpenSUSE
Step 1. Install the tool using the ZYPPER command:
sudo zypper in ncdu
On FreeBSD Unix
Step 1. Use the following command for FreeBSD systems:
sudo pkg install ncdu
On OpenBSD
You can run the DOAS PKG for OpenBSD systems:
doas pkg_add ncdu
On Gentoo
Lastly, you can use Portage to install Ncdu on Gentoo:
sudo emerge ncdu
Method 3. Install Ncdu on Linux From Source
Interested readers can always build/compile the tool from the source:
Step 1. First, get the tar package from the Git repo:
wget https://dev.yorhel.nl/download/ncdu-<VERSION>.tar.gz
tar -xzvf ncdu-<VERSION>.tar.gz
Step 2. Locate the package
cd ncdu-<VERSION>
Step 3. Configure the package for your system:
./configure
Step 4. Finally install Ncdu on it:
make
sudo make install
Method 4. Using Snap To Install Ncdu On Linux
Alternatively, you can always rely on third-party applications or platforms for installing tools on Linux. As such, we are demonstrating how to install Ncdu using Snap:
Note that: If you’re running Ubuntu 16.04 LTS (Xenial Xerus) or later, including Ubuntu 18.04 LTS (Bionic Beaver) and Ubuntu 20.04 LTS (Focal Fossa), you don’t need to do anything. Snap is already installed and ready to go.
Step 1. Start by updating the APT repo:
sudo apt update
Step 2. Then directly install Snap:
sudo apt install snapd
Step 3. Lastly, install Ncdu:
sudo snap install ncdu
Method 5. Install Ncdu Using Flatpak
Step 1. First, install Flatpak on your system:
sudo apt install flatpak
or,
sudo yum install flatpak
Step 2. Then, add the Ftathub repository:
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Step 3. Finally, install Ncdu using Flatpak:
sudo flatpak install flathub eu.ducktail.ncdu
Method 6. Using Homebrew to Install Ncdu on Linux
If your system supports Homebrew, you can use it to install Ncdu
Step 1. First, install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 2. Finally, install Ncdu:
brew install ncdu