How to Check Disk Space on Ubuntu 24.04

Managing disk space is a crucial task and sole responsibility of the system users. It helps them allocate the resources efficiently. Whether installing applications, storing files, or managing databases, getting accurate information about the disk space ensures smooth operations. It will also help users remove those applications that are taking up so much space to improve the system’s performance. 

In this tutorial, we will discuss possible methods to check disk space on your recently installed Ubuntu 24.04 system.

Outline

How to Check Disk Space on Ubuntu 24.04

Checking disk space on Ubuntu 24.04 can be done through the terminal or GUI. Here, we will discuss both these methods and their sub-methods if they exist.

Checking Disk Space on Ubuntu 24.04 from Terminal

You can check disk space on Ubuntu through the terminal via different commands, such as df, du, stat, fdisk, and lsblk. Let’s discuss how you can use these commands to check disk space on Ubuntu.

Using df Command 

df is a standard command used in the Linux system, including Ubuntu 24.04 that provides detailed information about the disk space. Running this command on the terminal will help you access how much space is occupied by different file systems mounted on the device. 

You can use the df command in different ways and get information like file system, total disk used, space used, space available, used percentage, and the partition where the disk is mounted. 

If you run the df command without passing any additional argument, you will see the disk information in 1-K blocks:

To view the disk space information in a much better way, you can use the -h argument with the df command:

df -h

If you want to view disk information on Ubuntu with an additional disk type column, you can use the -T argument with the df command:

df -T

By default, the disk space information provided by the df command is in KB, however, it can be changed to MB using the -m argument with the df command:

df -m

Note: We can combine the flags to better view the disk space information on Linux using the df command.

Using du Command

The du command is another versatile command you can use on your Ubuntu system to check disk space. Though the du command is not as powerful as the df command, you can still use it to find disk space information of the current directory and its subdirectories. 

Simply running the du command without passing any additional argument will provide you with the disk space of the current directory and subdirectories:

However, the default information provided by the du command is not in the human-readable format. It means you can’t find out the unit of the disk space. 

To view the disk space on Ubuntu in the human-readable format, you can use the -h argument with the du command:

du -h

To get the total disk space information of the current directory, use the below-given du command:

du -sh

Using stat Command

stat command is another command that provides you with detailed information about a file or a file system on Ubuntu. This information includes the size of the file, use ID and group ID, access permission, disk space, and more. The stat command can accept a single or multiple input file names and has several arguments that you can pass to change its behavior.

To check the disk space and other additional information of a file, or directory on Ubuntu, run the stat command followed by the file or directory location:

stat [file/directory location]

Using fdisk Command

fdisk is a powerful command used in Linux systems for managing disk partitions. You can use the fdisk command on Ubuntu to check for the disk space information of currently mounted disks. However, the fdisk command only provides information about the existing partitions and their sizes. You won’t be able to see the entire disk space information like df and du commands.

You can only run the fdisk command with sudo privileges and an additional -l argument to get your desired result on the terminal:

sudo fdisk -l

Using lsblk Command

The list block devices, commonly referred to as lsblk is a part of the util-linux package that allows you to list all blocked devices, their partitions, disk space, and file systems. When you invoke lsblk command without any argument, it produces a tree-like output, that includes all block devices attached to your system. In the list, you will also find out the disk space information of blocked devices on your system:

lsblk

The lsblk command doesn’t provide detailed information on the disk space like other commands. However, you can sum up the sizes of all the partitions manually and compare them with the total disk space to determine the overall unallocated space on Ubuntu. 

Additional Utilities for Checking the Disk Space on Ubuntu 24.04

Besides using the pre-installed commands for checking the disk space, you can also install some additional utilities like ncdu and pydf on Ubuntu. Both these utilities are useful in providing you with information on the total disk space on your Ubuntu system.

To use ncdu on Ubuntu, first install it from the Ubuntu standard repository using the following command:

sudo apt install ncdu -y

Once you complete the ncdu installation, simply run the ncdu command on the terminal to get the disk space information on Ubuntu:

ncdu

Note: You can close it using the q button.

The same case applies to pydf, which can be installed on Ubuntu from the following command:

sudo apt install pydf -y

Once completed, run the pydf command on Ubuntu to get the disk space information on the terminal:

pydf

Checking Disk Space on Ubuntu 24.04 from GUI

You can also use the GUI utility called Disk Usage Analyzer preinstalled on Ubuntu to check disk space on the system. You can open the Disk Usage Analyzer on Ubuntu from the application menu by searching it with the disk usage keyword from the search box:

Once the application is opened on the Ubuntu desktop, you will see different directories on the menu:

You can click on any directory to view the disk space information of the content included inside the directory. 

Here, we have opened the directory ilf, and got the complete disk space information of the contents inside the directory on Ubuntu:

Besides that, you can also open another GUI utility called Disk from the Application menu to check for the disk space information on Ubuntu:

Click on your desired disk to check the disk space information:

Image 1

That’s the different way you can check disk space on Ubuntu 24.04 from the terminal and GUI.

Conclusion

Checking disk space on Ubuntu is a useful task that helps you manage the space on the system to eventually boost your system performance. You can check disk space on Ubuntu 24.04 both from the terminal and GUI. For the terminal, you can use built-in commands like df, du, fdisk, and lsblk to check disk space on Ubuntu. You can also install additional tools like ncdu and pydf to check disk space on the system from the terminal. For GUI, you can open preinstalled applications like Disk Usage Analyzer or Disks from the application menu to check disk space on your Ubuntu system.