Is there a way to quickly check the amount of free / used disk space in Ubuntu?

I would assume you could right click on 'file system' in the file browser and choose 'properties' or something but there is no such option.

15 Answers 15

up vote 454 down vote accepted

Open System Monitor from Dash and select the Filesystems tab.

enter image description here

Or alternatively open a Terminal and type:

df -h
  • 6
    thanks! got me what i need. But it is kind of a bummer that there's no intuitive way to check the hd usage. I imagine most people would get frustrated trying to figure it out. – greg Oct 28 '11 at 21:11
  • 6
    Well. Every time you are in a folder in nautilus, it says at the bottom how much space is left on the device. – Elvis Stressborg Nov 2 '11 at 23:15
  • 3
    @greg: Actually, it isn't as straightforward as you might think, since the UNIX way of mounting filesystems means that any folder's contents can potentially exist on different disks or partitions. Thus, any method of checking free space must explicitly account for this. – Scott Severance Nov 3 '11 at 3:17
  • 45
    df -h --total – nutty about natty Mar 10 '13 at 14:22
  • 5
    df for used and free space in bytes, df -m for space in units of 1MB, df -h for largest available unit. You will also get % usage, it remains same with all the above though. – Fr0zenFyr Jan 17 '14 at 4:45

You can use baobab, or similar tools such as kdirstat or filelight, to see what files are using up your disk space.

Baobab is also called Disk Usage Analyzer on Ubuntu.

Here's a sample screenshot of baobab:

baobab

Below is a sample screenshot of filelight:

filelight

For a command line option, I prefer to use ncdu:

ncdu

You can drill into sub-folders to get total relative disk usage on the sub-folders. It's turtles all the way down. More nifty than du -sh on remote machines.

  • 17
    Was not aware of ncdu until now. VERY useful program. I went from issuing du -sk * | sort -n to using ncdu. While I do enjoy being able to issue a few handy commands in a terminal or even making aliases out of them, no sense reinventing the wheel. – Tass Mar 21 '16 at 14:57
  • Enableing now, only v1.8 though :( – Jamie Hutber Apr 15 '16 at 9:59
  • 4
    ncdu is a great tool, very fast, very awesome. – Boinst Jul 12 '16 at 4:42
  • kdirstat was remade as QDirStat and it is insanely fast and an excellent graphical representation of drive / (recursive) folder usage. – Blauhirn Feb 22 '17 at 12:28
  • ncdu is a great tool. We use it in our team to find the top users/hoggers – Viet Nov 14 '17 at 8:10

gnome-system-monitor or df -h or lsblk

Other useful utilities are baobab.

  • 1
    Agree with user606723. Cool utility baobab :) – Dhaval Jan 9 '14 at 11:06
  • lsblk lists the size of each partition, not the free space. – Franck Dernoncourt Oct 23 at 23:26

If like me all you need is the total of disk space used then just use the following command.

df -h --total

⚡️ Complimentary GIF.

total disk space

Here's a sample output with the total shown at the end

Filesystem      Size  Used Avail Use% Mounted on
udev            478M     0  478M   0% /dev
tmpfs           100M  4.5M   95M   5% /run
/dev/vda1        20G  3.3G   16G  18% /
tmpfs           497M     0  497M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           497M     0  497M   0% /sys/fs/cgroup
tmpfs           100M     0  100M   0% /run/user/0
total            22G  3.3G   17G  17% -

Cheers!

P.S. I wrote a post about it — How Do I Find the Amount of Free Space on My Hard Drive with Command Line?

  • which theme are you using for your shell. Also how are you recording gif ? please guide. – Karan Ahuja Oct 15 at 7:52
  • Well, I have my own suit of themes called 🦄 Shades of Purple themes for Zsh, iTerm2, Hyper, and especially for VSCode. You can read about my set and what I use on this link 👉 AhmadAwais.com/uses —— Peace! ✌️ – Ahmad Awais Oct 16 at 16:15
  • I'm amazed that --total has to be explicitly specified rather than explicitly excluded. – Alex Johnson Dec 4 at 21:14

Free/used disk space is always related to a partition

First you need to decide which partition you are interested in.

root@pc:~# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/sda1               28G   26G  643M  98% /
none                   4.0K     0  4.0K   0% /sys/fs/cgroup
udev                   3.9G  4.0K  3.9G   1% /dev
tmpfs                  790M  1.5M  789M   1% /run
/dev/sda6              887G  685G  158G  82% /home

In my case I am interested in the / since it has 98% in use. In other words it is nearly full.

Now I use this command to see which files and directories contain the most bytes:

root@pc:~# du -ax / | sort -rn > /var/tmp/du-root-$(date --iso).log

Above command can take some time. If you are really unlucky the result is too big for /var/tmp. Then you need an other destination. Maybe a temporary mounted usb memory stick.

Here are the first lines of my result:

root@pc:~# less /var/tmp/du-root-$(date --iso).log
26692380        /
9875188 /usr
8931652 /var
4057324 /var/log
4038176 /var/log/bootchart
3784016 /usr/share
2934248 /lib
2799204 /usr/lib
2785176 /lib/modules
2617048 /var/lib
2141124 /usr/src
1834444 /var/lib/docker
1817372 /var/lib/docker/aufs
1817076 /var/lib/docker/aufs/diff
1769612 /localhome
1338484 /tmp

Why is /var/log/bootchart that big? .... That is an other question ...

There are a number of ways to do this.

  • Enable the status bar in the View menu in Nautilus. This will place a bar at the bottom of all nautilus windows telling you the free space.

  • Use the File Systems System Monitor to view a list of all disks and their free space.

  • Use the Disk Usage Analyzer to get a listing of all directories on your system and how much free space they take up.

  • Go to any folder in nautilus and right click the background. Open the properties window to check the free space.

  • Run the command df -h.

  • Disk Usage Analyzer was what I needed, a simple Windows-style per-drive breakdown (used / total) rather than a bunch of directories which are on the same drive. – Sina Madani Apr 24 at 22:59

Another way! Right click on computer in Nautilus (file explorer) and click properties. It displays how much free and used space is on your hard drive. enter image description here

Using dconf-editor or gsettings (sudo apt-get install dconf-tools) you can enable the default behavior of the status bar.

Type this on your terminal to enable the status bar by default

gsettings set org.gnome.nautilus.window-state start-with-status-bar true

Type this on your terminal to disable the status bar by default

gsettings set org.gnome.nautilus.window-state start-with-status-bar false

After that you will have the statusbar opened by default on Nautilus, no need to run anything else.

I wrote a little hack for this with a command line and gui version. It's rather hard-coded, so may need some tweaks. Also, the gui version appears to use a proportional font that messes up the alignment of the displayed output. These scripts could be put in your path somewhere (like in $HOME/bin) and you can create an icon for the gui script on your desktop or panel.

#!/bin/bash
## jdf - Copyleft 04/25/2009 - JPmicrosystems - GPL
## Free space on disk
## Custom df output
## Human readable (-h)
## sorted by file system name

## Make a temporary file and put the following awk program in it
AWK=$(/bin/mktemp -q /tmp/jdf.XXXXXX)

## PROG is quoted to prevent all shell expansions
## in the awk program
cat <<'PROG' > ${AWK}
## Won't work if mount points are longer than 21 characters

BEGIN {
  ## Use fixed length fields to avoid problems with
  ## mount point or file system names with embedded blanks
  FIELDWIDTHS = "11 11 6 6 5 5 21"
  printf "\n%s\n\n", "                    Available Disk Space"
  printf     "%s\n", "Mount Point          Avail Size  Used  Use%  Filesystem Type"
}

## Eliminate some filesystems
## That are usually not of interest
## anything not starting with a /

! /^\// { next }

## Rearrange the columns and print

{
  TYP=$2
  gsub("^ *", "", TYP)
  printf "%-21s%6s%6s%5s%5s %s%s\n", $7, $5, $3, $4, $6, $1, TYP
}

END { print "" }
PROG

df -hT | tail -n +2 | sort | gawk -f ${AWK}

rm -f ${AWK}

Sample output:

                   Available Disk Space

Mount Point          Avail Size  Used  Use%  Filesystem Type
/                      22G  30G  6.6G   24%  /dev/sda6  ext4    
/media/dataspace       44G 155G  105G   71%  /dev/sda8  ext3    
/home                 5.5G  32G   25G   82%  /dev/sda9  ext3    

Gui version:

#!/bin/bash
jdf | zenity  --title "Available Disk Space" --text-info --width=500 --height=300 --timeout=60

New Gui Version with fonts fixed using yad

#!/bin/bash

jdf | yad  --fontname="DejaVu Sans Mono 12" --title "Available Disk Space" --text-info --width=650 --height=300

In lubuntu you can do as follows:

1- Start Button > Accessories > Disks

2- Start Button > Preferences > Disks

enter image description here

There's df information all over the net, but I like output that's simple and easy to read.

If you run

df -h --total

the bottom line in the output will give you exactly how much is left in your system, as well as how much is used etc.

The other option is to use

df -h --total | grep total

which will show it in one line as

  • (1) total space
  • (2) total space used
  • (3) total space still available
  • (4) percentage of drive used.

All of this in gigabytes.

I mapped this to a shell command dspace and when I type that into terminal it instantly shows me my disk space usage.

You can even write little shell commands that will monitor it and alert you if you get too low etc.

If you use Ubuntu with MATE DE (Ubuntu MATE) you can use MATE Disk Usage Analyzer:

  • its icon is located in Applications->System Tools
  • it is a part of mate-utils package
  • its executable is named mate-disk-usage-analyzer
  • its screenshot is presented below:

    MATE Disk Usage Analyzer

    even on latest 18.04 LTS it looks traditionally nice.

If you have facing the issue in low disk space in android studio,just delete the unwanted emulator in your AVD manager.I wasted the whole to try other things.it help full to any one.it working for me.

Simply you can find available free space using free command .. Here you can get clear explanation about free command usage

using "free" command to find free space available on Linux

  • The free command is for memory, not for hard disks. – PerlDuck Sep 21 at 17:58

You could also use for the most comprehensive health status information about your hard drive: smartctl --xall /dev/sda.

It could require sudo privileges.

  • The storage medium itself and its S.M.A.R.T. self-diagnosis system have no concept or knowledge of occupied/free space or file systems. -1 – David Foerster Jan 1 at 23:34

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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