You’ve had your Raspberry Pi working away, first as a media center – then a web server with a database and you’ve been tinkering with lots of other features, so what is taking up your space?

Luckily the Raspberry Pi, when running Raspian has a good command-line tool already installed.

Just type the  following into an SSH terminal.

ncdu

To only show files on a certain page (for example your root drive and not all attached devices)

ncdu -x /

 

 

Disk Space Usage Chart

The display of ncdu will show your something like below – you navigate using the arrow keys and find out where your space is going!

    2.6GiB [##########] /usr                                                                         

    1.0GiB [###       ] /home

  633.8MiB [##        ] /opt

  593.0MiB [##        ] /var

  141.4MiB [          ] /lib

   10.2MiB [          ] /media

   10.1MiB [          ] /mnt

    7.9MiB [          ] /bin

    7.5MiB [          ] /sbin

    6.7MiB [          ] /etc

    1.7MiB [          ] /tmp

   40.0KiB [          ] /root

e  16.0KiB [          ] /lost+found

e   4.0KiB [          ] /srv

>   0.0  B [          ] /sys

>   0.0  B [          ] /run

>   0.0  B [          ] /proc

>   0.0  B [          ] /dev

  0.0  B [          ] /boot

Additonal options

There are additional options available, one of the most useful is the ability to output the report – just add in the flag -o  e.g.

ncdu -x -o /home/pi/filesystem.txt /

This file isn’t readable – but you can have multiple files and using -o you can import the file – this way you can compare sizes if you are tying to monitor space problems.

Hopefully this will help you out.