How do I find the amount of free space on my hard drive?
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.
018 Answers
Open System Monitor from Dash and select the Filesystems tab.
Or alternatively open a Terminal and type:
df -h 8 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:
Below is a sample screenshot of filelight:
For a command line option, I prefer to use 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.
If like me all you need is the total of disk space used then just use the following command.
df -h --totalHere'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% -I wrote a post about it: How Do I Find the Amount of Free Space on My Hard Drive with Command Line?
1gnome-system-monitor or df -h or lsblk
Other useful utilities are baobab.
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% /homeIn 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).logAbove 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 /tmpWhy 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.
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.
There's df information all over the net, but I like output that's simple and easy to read.
If you run
df -h --totalthe 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 totalwhich 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.
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=60New 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 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 trueType this on your terminal to disable the status bar by default
gsettings set org.gnome.nautilus.window-state start-with-status-bar falseAfter that you will have the statusbar opened by default on Nautilus, no need to run anything else.
In lubuntu you can do as follows:
1- Start Button > Accessories > Disks
2- Start Button > Preferences > Disks
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-utilspackage - its executable is named
mate-disk-usage-analyzer its screenshot is presented below:
even on latest 18.04 LTS it looks traditionally nice.
Filelight is the best graphical program to find out the usage of some mounted partitions. Doesn't show everything which is mounted by the system, but displays enough data which should suffice an average user. Does not require root to work, can be run as a regular user. Belongs to KDE.
Go to Utilities / Disks it will give you the percentage of use. Linux is divided in to two SDAs, the first is for the OS, the second is for the files (available space)
1A command-line option: parted in command mode:
$ parted /dev/nvme0n1 unit GiB print free
Model: Samsung SSD 970 EVO Plus 1TB (nvme)
Disk /dev/nvme0n1: 932GiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags 0.00GiB 0.00GiB 0.00GiB Free Space 1 0.00GiB 0.50GiB 0.50GiB fat32 boot, esp 2 0.50GiB 732GiB 731GiB ext4 732GiB 932GiB 200GiB Free Space
$
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal
$
$ parted --version
parted (GNU parted) 3.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by <
$Taken from this unix.stackexchange.com answer.
lsblk with some extra options works pretty well.lsblk -o NAME,MOUNTPOINT,SIZE,FSUSED,FSAVAIL,FSUSE%
You can customize the columns. If you want more device level info add VENDOR,LABEL,UUID.
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.
1Simply 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
1