Ubuntu

How to check the disk space in Ubuntu

Monitoring the disk space is a very important activity to perform on any device like mobile, laptop, personal desktop computer, and Linux server. For instance, if you want to install any new application or software on your device, then it is important to know about the disk space. By checking the disk space, you can get to know about the free and used space.

We can check the disk space from the terminal and graphical user interface based applications.

The commands discussed in this article are generic and can be used on other Linux distribution like Debian, Linux Mint, etc.

Checking the Disk Space from the Terminal

There are many useful commands for checking the disk space from the terminal. In this section, we will discuss the df and du commands.

Using the df command to check the disk space:

The df (Disk Filesystem) command comes pre-installed on Ubuntu 20.04, Ubuntu 20.10, and many other different Linux based operating system. The df command shows the information of various file systems. Moreover, we can use multiple options with it.

Let’s check the disk space using the df command as follows:

$ df

The df command shows the total used and available space. Moreover, it also shows the total used space in terms of percentage. In the above-given output, the system’s actual disk is /dev/sda5. The df command shows the disk information in 1k-blocks, and it is very difficult to interpret the output. We can use the -h option with the df command to display the disk space information in a human-readable way, as illustrated in the below image:

$ df -h

The df -h command shows the disk space in gigabytes. In the above-given output, it can be seen that in the in /dev/sda file system, the total size of the disk is 29 gigabytes, whereas the used and available space is 13 and 15 gigabytes, respectively.

Using the du command to check the disk space:

The du command stands for Disk Usage. It shows the disk information of every directory and subdirectory. Let’s execute the following du command:

$ du

The size of directories of subdirectories is displayed in 1k-block.

The –h options can also be used with the du command to display the disk information in a human-readable way, as shown below:

$ du -h

The du -h command shows the disk usage in kilobytes and megabytes.

Checking the Disk Space from the Graphical Applications

Checking the disk space using the graphical user interface based applications is very easy in Ubuntu 20.04 and 20.10. There are two graphical applications for checking disk space, i.e., Disk Usage Analyzer and Disks.

Using the disk usage analyzer application:

Open the ‘Application Menu’ and search for the disk usage analyzer application.

Click on the ‘Disk Usage Analyzer’ application icon to open it. You will see the actual disk with ‘Available’ and ‘Total space’. Click on the disk to see more details.

Using the disk utility:

The Disk GNOME utility comes pre-installed in Ubuntu 20.04 and 20.10. Search for ‘Disks’ in the ‘Application Menu’ and open it.

The ‘Disks’ utility shows the total size of the disk and the free disk space.

Conclusion:

Checking the disk space is a very important activity for smooth system usage. In Ubuntu 20.04, 20.10, and many Linux distributions, we can check the disk space from the command-line and graphically. This article explains the commands and graphical applications for checking the system disk usage.

About the author

Kamran Sattar Awaisi

I am a software engineer and a research scholar. I like to write article and make tutorial on various IT topics including Python, Cloud Computing, Fog Computing and Deep Learning. I love to use Linux based operating systems.