Disk Usage Analyzer on Linux

Olá

Often we found our server disk is full and usually system administrator will check it using the du command. The du command is a standard Linux/Unix command that allows a user to gain disk usage information quickly andncdu command more advanced than du.

Ncdu is a disk usage analyzer with an ncurses interface. It is designed to find space hogs on a remote server where you don’t have an entire graphical setup available, but it is a useful tool even on regular desktop systems. Ncdu aims to be fast, simple and easy to use, and should be able to run in any minimal POSIX-like environment with ncurses installed.
NCurses Disk Usage

Installation

CentOS

Add or update the epel-release repository to start:

yum install epel-release

Install ncdu package with:

yum install ncdu

Fedora

Same as CentOS, add or update the epel-release repository to start:

yum install epel-release

Install ncdu package with:

dnf install ncdu

Ubuntu and Debian

Install ncdu package with:

sudo apt install ncdu

How to use

To start using ncdu, use the following command:

ncdu /

ncdu will process and analyze your entire / directory:

After the disk usage analysis process is complete, we can check the entire disk usage and use the keyboard:

  • up, k, ↑ – used to move the cursor up
  • down, j, ↓– used to move the cursor down
  • right, enter, l, →  – Open selected directory
  • left, <,h, ← – This opens parent directory
  • n – order by name (press again for descending order)
  • s – Order by file size (press again for descending order)
  • d – Delete selected file or directory
  • g – Show percentage and/or graph
  • t – Toggle dirs before files when sorting
  • c – Toggle display of child item counts
  • b – Spawn shell in the current directory
  • i – Show information about the selected item
  • r – Refresh/recalculate the current directory
  • q – Quit ncdu

Thanks for reading!

tchau