If you often work with large or many files on the Raspberry Pi, sooner or later you will face the problem that the available memory is running out. At least that's what happened to me.
Especially when there are several distributed files, it is not so easy to get an overview of which files and folders are using how much memory. Without additional tools, you have to switch to each folder individually, list the file content including the file size in order to get an overview of the largest files. Pretty cumbersome.
A tool that makes this process much easier is called "ncdu". How you install this tool and how you can use it is described in the following article.
Safety instructions
I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/sicherheitshinweise/
Affiliate links / advertising links
The links to online stores listed here are so-called affiliate links. If you click on such an affiliate link and store via this link, Nerdiy.de receives a commission from the online store or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂
Requirements
Helpful articles:
Before you start this article, you should have prepared a Raspberry Pi so that it can be reached via the network and controlled via SSH.
The following articles describe what needs to be done to prepare the Raspberry Pi.
- RaspberryPi - Setup for nerdiys!
- RaspberryPi - The first configuration!
- RaspberryPi - Control the RaspberryPi via SSH
In the following lists you will find all the parts you need to implement this article.
Required tool:
Number | Link |
---|---|
1x | Screwdriver set Buy at Amazon |
1x | SD card reader Buy at Amazon |
Required material:
Number | Link |
---|---|
1x | Raspberry Pi Buy at Amazon |
1x | Raspberry Pi power supply Buy at Amazon |
1x | Raspberry Pi case Buy at Amazon |
1x | Micro SD card 64GB Buy at Amazon |
Log in via SSH on the RaspberryPi
To get started, you first need to log in to RasPi with SSH on Putty. How to do it is described in the article

Update package management
The package management in Linux is a "central point" over which various software packages can be installed. For this to work reliably, the lists and sources of package management should be updated before installing any new packages.

sudo apt-get update && sudo apt-get upgrade



Install NCDU
In order to be able to use NCDU, you must of course install it first.
Use NCDU to view memory usage for each folder and file
After installation, you can use NCDU without further configuration.

NCDU starts on it and scans all directories starting from the directory in which it was started. So if you have previously changed to the base directory with "cd /", NCDU will show you an overview of the complete base directory.

After the scan is completed, you will be shown an overview of the memory consumption of the folders in this folder level.

You can now use the up and down arrow keys to select a folder. As soon as you press the Enter key, NCDU changes to this selected folder and shows you the memory consumption of the folders it contains.

In this way you can navigate through all folders and get a very good overview of the memory usage of each folder.
More articles on the topic
In the following category you will find further links on the subject of Rasperry PI.
Have fun with the project
I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂
P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate that I share this information with you, I would be happy about a small donation to the coffee box. 🙂