Is there a command line package/application to get a good (maybe visual) overview over the free/used space left on Pi's SD-card. ls -lh is nice but it does not show me how much space the content of a folder uses.

Also it would be helpful if it gives me a fast comparable overview. You know, like tree to ls is.

My Pi is accessed via ssh, so it has to be command line or some kind of a remote application I can run on Ubuntu Linux 13.04.

Background: I set up bittorrent sync on my Pi and it works fine, but now I'd like to know available free-space. I read somewhere, deleted files are cached in a hidden folder or the native trash. So I'd want to watch this, but also the entire files/folders on SD-Card.

7 Answers 7


Use the command ncdu. It is a console program to display disc usage. It has a ncurses GUI. I usually run ncdu -x <some folder>, the x switch is there to not cross filesystem boundaries.

apt-get install ncdu

ncdu man page

  • This is the best option if you are running a stock (or close to) Raspbian Wheezy image.
    – DrCord
    Mar 29, 2014 at 19:16
  • 3
    Type 'q' to exit ncdu.
    – Obromios
    Nov 7, 2015 at 22:33

I'd use:

du -s * | sort -nr | head

-s prevents a lot of unnecessary output, -nr sorts numerically in reverse order and head cuts only the interesting part, you may omit it if you prefer all the results.

Also, if you need just an overview of your file system you may use

$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
rootfs          15136768   1618580  12884780  12% /
/dev/root       15136768   1618580  12884780  12% /
devtmpfs          240516         0    240516   0% /dev
tmpfs              49756       604     49152   2% /run
tmpfs               5120         0      5120   0% /run/lock
tmpfs              99500         0     99500   0% /run/shm
/dev/mmcblk0p1     57288     18888     38400  33% /boot
/dev/sda1      961433632 108173348 804422208  12% /home/stuff

or maybe with -h to get more human-readable numbers.


Since you are using Linux as the remote system, you could use baobab to monitor the file system: baobab GUI

If you select Analyzer > Scan remote folder you should be able to remotely build a graphical tree map of the Raspberry Pi's file system, I have tested this using the SSH option and it does seem to work, but also seems a bit slow to generate the tree (I assume it uses alot of SSH commands to do it's work).


tree -dh --du /

Should give you a tree of only directories but showing each with the corresponding size of it's contents in a human readable number (Most folders will list 4.0K since that is the size of an 'empty' folder).

Adding -L number will allow you to set the maximum depth to drill down to as well

tree -dh --du -L 3 /

will show up to 3 tiers below the '/' directory

  • Great idea to use baobab, but (to me) it says only 0Bytes for every file or folder. Percentage seems to be shown more or less correctly. I accessed like this: ssh://pi@homeserver/ is that the correct way?
    – verpfeilt
    May 20, 2013 at 12:22
  • @chocobai I ran it using the Analyzer > Scan remote folder, selected SSH and then provided the IP address and username, followed by the password when prompted (in my case I ran this from one Pi checking another).
    – PiBorg
    May 20, 2013 at 13:04
  • In the newest Ubuntu Version this is what Baobab (3.6.4) looks like: iloveubuntu.net/ubuntu-1210-alpha-2-released When I click on scan remote folder I can only enter an URL. There is an example URL with SMB but I don't want to scan my SMB folders only.
    – verpfeilt
    May 20, 2013 at 15:32
  • Best thing I can suggest is to mount first using sshfs then use the local path, e.g. sudo sshfs pi@homeserver:/ /mnt/remote, if necessary use the terminal to load gksudo baobab /mnt/remote
    – PiBorg
    May 20, 2013 at 16:17
  • Yes that works, thanks. Unfortunately It's not very comfortable (with sshfs and so on) and needs some time to analyze.
    – verpfeilt
    May 20, 2013 at 17:00

If you have an X display, xdiskusage is particularly handy.

To install it on a Debian or Debian-like system: apt install xdiskusage

To run it in order to find out which directory is taking up so much space within your home: xdiskusage ~ => here is the output from my own home: disk usage home

Larger directories are shown as large rectangles, the graphical output is ordered: biggest directories are shown first.

If you want to find out what is taking up space on your whole filesystem (preferably to be run as root, so that you have all necessary privileges to correctly get all directories' contents): xdiskusage /

Here is the output on my system: disk usage whole filesystem

You can browse through the directory tree by using arrow and Enter key. Enter bases the global view with its root at the selected directory, left goes up one level in the hierarchy (lynx-style): very handy.

Right-click opens a contextual menu with shortcuts. I only wish there would be a menu entry to "open a terminal here".

It is not as pretty as baobab, but it does the job.


You can use 'du' command.(du - estimate file space usage)

go to any directory then try it.

cd /usr; du -m

-m : block size 1Mb -k : block size 1Kb -h : human-readable


You can find more information at man page of du;



The most useful I find is

$ du -m | sort -n

This lists the size in megabytes and sorts numerically. ie. the biggest directories/files are at the bottom of the list.

$ du -k | sort -n

works too, but shows the sizes in kilobytes


As mentioned above by PiBorg: Baobab is a disk usage gui, and the gui makes it very easy to find dirs using the most disk (sdcard) space.

To install:

sudo apt-get install baobab

To run:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.