How to Check the Disk Space in Ubuntu 22.04

Disk space refers to the available or consumed amount of storage in the computer system. It represents the capability of a computer system to store data. Being the system administrator, it is a good practice to monitor the disk space frequently.

This write-up will provide you with the deep knowledge to learn how to check the disk space in Ubuntu 22.04. The outputs of this blog are:

Let’s start with the CLI method first:

Method 1: Check Disk Space on Ubuntu 22.04 Using Command Line Interface

Terminal, a widely used command-line application, provides various command-line utilities to monitor and manage the disk space. This section provides various commands that can be used to check disk space on Ubuntu 22.04.

Method 1.1: Using the “df” Command

Disk free (df) command displays the availability of disk space in Linux distributions. For checking the storage of disk space, utilize the following command:

$ df

The output showed the file system (of the available disks), blocks (represents the total size of the disks), used space, available space, and percentage as well.

To get the high-level (Human readable) output of the df command, you can use the “-h” flag with the df command as shown below:

$ df -h

Now the output is more understandable, the df command has printed the total size, used space, available space, and the percentage (total space used).

Method 1.2: Using the “du” Command

Disk usage (du) is a command that displays the disk space of every directory. Let’s examine its basic usage using the following command:

$ du

It displayed the occupied space of each directory and subdirectory.

To check the disk space of the home directory, execute the below script:

$ du -sh ~

The output shows the disk space of the Home directory.

However, you can use “-s” for the total size of the specified folder, “-m” for the size of the folder/file in Megabytes, and -k for Kilobytes.

Method 2: Check Disk Space on Ubuntu 22.04 Using Graphical User Interface

GUI of Ubuntu 22.04 provides a Disks utility to check and manage the disk space. To launch the “Disks” application, go to the“activities”, click on “applications”, and navigate to the search bar.

Type the “disks”to search the application and click on it, as follows:

It will open the following interface. Select the Disk to whom you want to check the space as follows:

On the left pane of the window, the available storage devices are mentioned. Upon clicking anyone of these, you will get the storage information of the respective storage devices.

Congratulations! You have learned to check the disk space via the CLI and GUI of Ubuntu 22.04.

Conclusion

The disk space can be checked in Ubuntu 22.04 using the Command Line or Graphical User Interface. Disk space refers to the available or consumed amount of storage in the computer system. It represents the capability of a computer system to store data. This write-up illustrated several methods for checking disk space in Ubuntu 22.04. The Command-Line Interface uses the “df” and “du” commands, while GUI utilizes the “Disks” application to check disk space in Ubuntu 22.04.