Obtain an overview of storage usage with "ncdu"

Oct 30, 2021·
Dennis
Dennis
· 1 min read
Image credit: DALL-E

I ran a rather decent monitoring system for my servers at home based on prometheus. My monitoring service sends an alert, if some file systems start filling up. Unfortunately, in most cases, I don’t know, what file(s) cause this mess. I use ncdu to find the largest files in the alerted filesystem. This short article shows how to install and use this small helper.

Requisites for readers

This article is written for people with a basic understanding in “Linux” operating system. To make this article easier to read, I do not prefix commands run as root with sudo. Instead, I use the following syntax for the commands in this article. But for your daily business, I definitively recommend using the sudo-command.

  • $ command : Running the command as a normal or admin user
  • # command : Running the command as root

Setup and use the “ncdu”-command

  • Computer Install package

    First, install ncdu.

    # pacman -S ncdu
    
  • Computer Run ncdu

    Running ncdu requires the privilege to read for all files in the given directory.

    $ ncdu
    
    ncdu 1.16 ~ Use the arrow keys to navigate, press ? for help
    --- /tmp -------------------------------------------------
        6.3 GiB [###########################] /rclmpdffzdt9bta