Home APPS How to analyze storage usage on a Raspberry Pi with Ncdu

How to analyze storage usage on a Raspberry Pi with Ncdu

by Emmanuel
analyze data storage raspberry pi

The abbreviations Ncdu stand for NCurses Disk Usage. Ncdu is a disk utility for Unix systems. Its name refers to its similar purpose to the du utility; however, ncdu uses a text-based user interface under the [n] curses programming library.

In other words, ncdu is a disk usage analyzer with an ncurses interface designed to find space hogs on a remote server where you don’t have an entire graphical setup available. The tool is handy even on regular desktop systems.

Analyzing storage usage on a Raspberry Pi with Ncdu

The ncdu is a command-line tool that enables standard viewing of disk space usage. It actually displays disk space used by individual directories. The tool aims to be fast, simple, and easy to use and should run in any minimal POSIX-like environment with ncurses installed.

Installing Ncdu

By default, the ncdu comes pre-installed on Raspberry Pi Os. However, there are some instances where you might miss it. In case it is not installed, you can use the following commands to install: 

First, update the system before installing the tool

sudo apt-get update
update system

update system

sudo apt-get install -y ncdu
install ncdu

install ncdu

you can check the version of the installed ncdu using the following command:

ncdu -v
ncdu version

ncdu version

Thereafter, we will run ncdu.

Running Ncdu

Running the Ncdu utility is as simple as typing ncdu on the command line:


This will thereafter initiate a breakdown of all the folders in the current active directory as shown in the snapshot below:

run ncdu command

run ncdu command

You can either browse to the directory you are interested in and then run ncdu, or else you can specify the path at the same time, for instance:

ncdu /home/pi
specifying the location

specifying the location


ncdu /
not specifying location

not specifying location

However, we recommend targeting a specific path to limit the file structure the tool will process, thus taking a shorter time.

On the terminal window, use the arrow keys to move through the list of directories and click “ENTER” to drop down into the next step/level.

Ncdu keyboards shortcuts

To run the help command, use “?” Symbol:

help command

help command

Some of the shortcuts used in this tool include:

? – It is used to show help + keys + about screen

up, down j, k – It is used to maneuver through the items

right, enter, l – it is used to open the selected directory

left, <, h – it is used to go to the parent directory

n – It is used to order by filename (press again for descending order)

s – it is used to order by filesize (press again for descending order)

C – it is used to order by number of items (press again for descending order)

a – it is used to toggle between showing disk usage and showing apparent size.

d – it is used to delete the selected file or directory.

t – It is used to Toggle dirs before files when sorting.

g – It is used to toggle between showing percentage, graph, both, or none. The percentage is relative to the size of the current directory, and the graph is comparable to the largest item in the current directory.

c – It is used to toggle the display of child item counts, e.g., Show/hide ‘hidden’ or ‘excluded’ files and directories. Please note that even though you can’t see the hidden files and directories, they are still there and included in the directory sizes. Therefore, if you doubt that the totals shown at the bottom of the screen are incorrect, make sure you disable this option.

i – It is used to show information about the currently selected item.

r – It is used to refresh/recalculate the current directory.

b – It is used to spawn a shell in the current directory.

The following symbols seen on the snapshot below are found on the “Format” tab:

the format tab

the format tab


The article has gone through the steps needed to analyze storage on Raspberry Pi with Ncdu. First, we looked at the various commands that will aid you in installing the tool, check the version, and run the tool. After that, we also looked at the various help commands that you should acquaint yourself with for the effective use of the tool. To sum it up, this is a handy command-line tool that any Pi user should be aware of. To this far, we hope this article has covered all there is about analyzing storage with Ncdu on Raspberry Pi. Thanks for reading! And in case of any issue, do not fear to reach out.

You may also like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.