Methods of payment Abuse

What is the ncdu utility and how to install it

18.07.2023, 01:18

Ncurse Disk Usage (or simply ncdu) is a disk analyzer that provides information about the allocation and use of disk space on a computer or server.

Ncdu works in text mode using the curses library, which allows you to output information in a readable format in the terminal. It scans the specified directory and provides detailed information about the size of directories and files.

What is the advantage of ncdu?

Advantages of using NCDU:

  1. Ease of use: NCDU has a simple and intuitive command-line interface, which makes it accessible to a wide range of users.
  2. Filtering support: You can apply filters to exclude or include certain files and directories from analysis.
  3. Detailed view: ncdu allows you to get information about the size of each directory and file, as well as hierarchically arrange information in the form of a tree structure.
  4. Interactive mode: NCDU allows you to interact with the results of the analysis, allowing you to perform various actions, such as deleting files or copying.
  5. Portability: NCDU runs on a variety of operating systems, including Linux, macOS and BSD.

In general, ncdu is a very useful tool for analyzing disk space, which allows you to effectively manage and optimize disk usage on your computer or server.

When is it necessary?

Some examples of using ncdu:

  1. Identifying large files and directories: Can help you find large files or directories that take up a lot of disk space. This can be useful when searching for items that can be deleted to free up space.
  2. Identification of the most expensive directories: Displays information about the size of each directory, allowing you to see which directories take up the most disk space. This can help you avoid filling up the disk and will optimize the use of disk space.
  3. Analysis of disk usage by category: allows you to identify different categories of files that occupy disk space. You can find out how much space music files, photos, videos, documents, etc. take up. This can be useful for managing and organizing files on disk.
  4. Monitoring disk usage changes: NCDUs can be used to periodically scan and monitor disk space usage. You can set a scan schedule to track changes and quickly detect possible problems with disk filling.

How to install?

To install Ncurse Disk Usage (ncdu) on various operating systems, follow these steps.

Linux, Ubuntu and Debian

In an open terminal, run the command:

sudo apt-get install ncdu

CentOS and Fedora

In an open terminal, run the command:

sudo yum install ncdu

macOS

Using Homebrew, in an open terminal, run the command:

brew install ncdu

Using MacPorts, in an open terminal, run the command:

sudo port install ncdu

For BSD, FreeBSD, in an open terminal, run the command:

pkg install ncdu

OpenBSD in an open terminal, run the command

doas pkg_add ncdu

After successfully installing ncdu, you can start it by typing the command "ncdu" in the terminal. ncdu will start scanning the current directory, and then output information about the allocation and use of disk space.

Please note that you may need administrator rights (root) or the use of the "sudo" command to successfully install ncdu on some systems.