A simple tutorial demonstrates how to find free disk space in Ubuntu and other Linux distros using the command line and GUI tools.
Every day we create data, knowingly or unknowingly. And that directly costs disk space. A few commands in the terminal can give you a better idea about the storage situation in your Linux desktop or server.
Here are some of the ways how you can find free disk space in Ubuntu and similar distributions.
Table of Contents
Find free disk space in Linux using the commands line
You can use the df
command to check the amount of free disk space on a Linux system. The df
command displays information about the available disk space on your system, including the total size, used space, and free space for each file system.
To use the df command, open a terminal and run the df command without any arguments:
df
This will produce output similar to the following:
This output shows the total size, used space, and free space for each file system on your system. The “Mounted on” column shows the mount point of each file system, which indicates where it is accessible on the file system hierarchy.
The tmpfs is a temporary file system and not actually a disk partition. They are created for faster access to storage for apps. It improves performance. However, in the df
context, if you want to exclude tmpfs
from the listing use, the -x
switch as below:
df -x tmpfs
To check the free space for a specific file system, you can use the -t
option with the df
command, followed by the file system type. For example, to check the free space for the ext4
file system, you would use the following command:
df -t ext4
This will produce output similar to the following. Note that you didn’t specify the device file in the above command, such as sda1
or sda2
.
This output shows only the information for the ext4 file system, including the total size, used space, and free space.
Alternatively, you can use the -h option with the df command to display the sizes in human-readable formats, such as kilobytes, megabytes, or gigabytes. For example, to check the free space for the ext4
file system in human-readable format, you would use the following command:
df -h -t ext4
This will produce output similar to the following:
This output shows the sizes in human-readable format, making it easier to read and understand.
For more information on the df command and its options, you can consult the df
man page by running the following command:
man df
Find free disk space in Linux using a GUI tool
To check the amount of free disk space on a Linux system using a graphical user interface (GUI) tool, you can use the Disk Usage Analyzer (also known as baobab) application. The Disk Usage Analyzer is a graphical tool that allows you to view the usage and free space on your system’s disks and partitions.
This application should already be installed in your Ubuntu system featuring GNOME. This is a GNOME app. Hence you don’t need to install it. However, you can install it using the following command if needed.
sudo apt install baobab
To use the Disk Usage Analyzer, follow these steps:
- Open the Disk Usage Analyzer application. You can find the Disk Usage Analyzer on most Linux systems in the “System” or “Utilities” menu.
- In the Disk Usage Analyzer window, select the disk or partition that you want to check from the list on the left.
- The main area of the window will show a pie chart that displays the usage and free space for the selected disk or partition. You can use this chart to quickly see the amount of free space available on the selected disk or partition.
- If you want to see more detailed information about the usage and free space on the selected disk or partition, you can click on the “Scan” button in the toolbar to scan the selected disk or partition. This will update the pie chart and the list of files and directories on the right to show the latest usage and free space information.
The Disk Usage Analyzer also provides some additional features that can help you manage your disk space more effectively. For example, you can use the “Zoom In” and “Zoom Out” buttons in the toolbar to zoom in and out on the pie chart, making it easier to see the usage details and free space.
You can also use the “Treemap” view to see the usage and free space information in a treemap visualization, which can be useful for identifying large files or directories that are using up a lot of disk space.
Other tools
Furthermore, there are several disk usage analyzer tools available which we covered here. You may want to check out those apps. In addition, if you want to find free disk space to clean up your Linux system, including FlatPak, and Snap packages, do check out the following guides.
Wrapping up
I hope this guide helps you to find free disk space and reclaim the precious storage bytes. Do let me know in the comment box if it helps.