How do I Find the Amount of Free Space on My Ubuntu
Running into low disk space is a common problem, as most of us don’t keep track of our disk usage and available space. Monitoring the disk space is important to run the system smoothly and avoid any data loss.
Ubuntu being a widely used Linux distribution offers multiple ways, i.e., CLI and GUI to find the amount of free space on the hard drive. This post covers all the possible aspects to find the amount of free space on Ubuntu.
Approach #1: Find the Amount of Free Space Using df Command
The simplest way to Find Ubuntu Free Space using the df command. The df is the “disk-free” command and it shows the used and the remaining free disk space on your hard drive.
Using the df Command in Normal Mode
First, let’s understand the usage of the simple df command:
The output of this command will show you the name of the file under “Filesystem”, space allotted to that file in “1k-blocks”, the space used by the file under “Used”, free amount of space under the “Available” tag, along with the percentage of used space and “Mounted on” shows the purpose the file is used for.
Note:1k-blocks is the header for total space, and it reports the space in 1Kb blocks it takes a lot of effort to calculate this in Mbs or Gbs.
Using the df -h Command
To get the results output in human-readable format, use the “-h” tag along with the df command:
Now, the output is easily readable where the memory unit is either, KB (Kilo Bytes), MB (Mega Bytes), G (Giga Bytes).
Using the df -a Command
This command will show the complete usage of all the files present in your system even if the value associated with it is zero. This command is useful when one of your drives is out of space because the above commands will exclude that drive and you will only see drives with available spaces:
As you can see the system has shown all the available files and drives with and without extra space are listed using this command.
Using df -T Command
If you want to get the file type as well, then the -T option can be used with the df command:
The -T flag will give you results including the Type of the file. As you can see in the output each file now has a type associated with it.
Checking the Free Space By Specifying the Device Name
The device name can be used with the df command to get the storage information about the specific device. The device name is provided by the user, however, the df command also allows you to use it without mentioning the device name.
Both methods are demonstrated here.
Using the df With Device Name
Use the df command with the “h” flag and the device name as follows:
df -h /dev/(name of the device)
In the above output example, you can see the information related to sda3 (individual disk partition name).
This individual file search is important when you are keeping track of only one drive, as you already know the drive name so it’s wise to use this command instead of getting output for all file systems.
Using the df Without Device Name
If you are not sure about the primary storage medium on your system, you can run this command to get the storage results for your primary storage system:
df -h /
With the output you can see that it only gave results for the primary storage device of the test system.
Approach #2: Find the Amount of Free Space Using GUI
Apart from checking your disk storage from the command line, Ubuntu also comes with a disk usage analyzer application. To access it, use its name in the applications menu of Ubuntu.
After searching run the application.
This application will show you the available free space and the total free space for every partition in your disk. Unlike the command prompt, here only disk partitions, CDROM, and floppy Disk are listed. If you are looking for partition space this is the easiest way to check.
To find the free space on your hard drive, you can either use the command line or the GUI. Both will provide you with the data for free space and used space in KBs, MBs, GBs, etc. The df command with its various options serves the purpose well. This post has provided the CLI and GUI methods to find the amount of free space on Ubuntu.
[…] Find Ubuntu Free Space […]