Linux Commands

Linux Find What is Using Disk Space

“It’s crucial to manage storage capacity on a Linux system. Programs that act as package managers, for instance, alert you to the amount of disc space needed for setup. You need to be aware of the amount of free space on your machine for that knowledge to be useful. There are several utilities available in the Linux systems to discover what is using the disk space of our system. Discover how to examine the disc space in Ubuntu using the df utility as well as how to view the file system’s disc space consumption using the “du” tool throughout this lesson.”

Update System

Before checking the disk space usage, we need to update our system to make it fully updated so that the memory space can be displayed correctly. For this, try opening the console application of your Linux system with the use of the “Ctrl+Alt+T” shortcut. It will be launching the console quickly in a few seconds. We have tried the apt instruction with the sudo rights followed by the keyword “update”. The execution asks for the “password” of the currently active user at the moment. We have added the password, and the process continues.

Check Disk Space Usage With Df Utility

The main system part that uses the memory more than anything is the disk, usually in all operating systems. To find the amount of space used by the disk in the Ubuntu 20.04 system, we will be utilizing the “df” utility of our system. The df tool, which refers to disk free, displays how much space each drive is using. Values are shown by df by a standard in 1-kilobyte units. Within the “df” command output below, we have been shown the space used by the file system and the system’s related parts. It also displayed the percentage usage of space in the output.

Check Disk Space Usage in Mega & Gega Bytes

Within the above output, the disk space usage has been displayed in the 1-kilobyte format, while in the “used” and “available” column, we can only see disk space value in numbers, i.e., merely understandable. So, to display the disk space output in a more human-readable presentable format so that any computer user can understand it quickly and get any type of information required. For this, we need to use the “df” instruction with its “-h” option in the query area, as we have used this instruction in the attached photo. The output for the Size, Used, and Avail column has now displayed the result in Kilobytes, megabytes, and gigabytes after the conversion. While the “Use%”, and “Mounted on” columns have got no change in them.

You can also make use of the “df” instruction according to your needs. Let’s say you only want to look for the size of disk space, its available space, and its used space on your shell screen. For this, you need to use the “df” instruction with the “-H” option and the column names from the particular space table, i.e., Size, used, avail, as presented in the image below. The output below has displayed the data for these three columns and didn’t identify the program or disk.

Check Disk Space Usage for File System

The very same “df” instruction can be utilized in the console with its “-h” option to display the disk space used by the file system used in your Linux system. So, we have tried this instruction to check the space used by the “dev/sda2” device file system. The output shows that the disk “dev/sda” has a size of 2.4GB while 0 bytes are used, and the rest is available to be used.

The use of the “df” instruction with the “-h” option and the “/” character shows the amount of space used on the primary disk storage device. So, we have tried it and found that the primary disk “dev/sda5” has a size of 30GB while 14GB has been used and 15GB has been left unused and can be utilized shortly.

Check Disk Space Usage for File System by Type

You can try to find out the disk space usage for the file system according to the type of file system. For this, you need to use the “-ht” option within the “df” instruction along with the file system type, i.e., ext4 in our case. The output on our screens is showing quite similar output as above while the “mounted on” column has only a “/”.

Check Disk Space Usage With Du Utility

Disk use is seen via the du utility. You may see your disc performance in further detail with this utility by using Ubuntu 20.04 Console application to show the disk usage for certain folders. Use it to show how much storage your present directory is using, as we did in the below presentation. The left side numerical value shows the data size, and the right side shows all files and folders of our system.

The “du” instruction, along with the “-h” option, has been showing the space used by the folders in kilobytes at the console application screen of our system, as presented in the attached image.

If you want to find out the space used by your current working directory, you must utilize the “du” instruction with the combined option “-hs”. The result displays that it contains a total of 106MB of data within the system.


We have elaborated on the popular use of the disk space concept along with the different utilities of our Linux operating system. Firstly, we have tried to update our system to avoid any issues. After that, we discussed the use of “df” and “du” instructions separately to see how much space has been utilized by a particular disk drive. We have tried the “df” and “du” instructions with the “-H” or “-h” instructions for the view of disk space usage in the Kilobytes, Megabytes, and Giga bytes. Hence, we have tried to cover every minor detail in this article.

About the author

Saeed Raza

Hello geeks! I am here to guide you about your tech-related issues. My expertise revolves around Linux, Databases & Programming. Additionally, I am practicing law in Pakistan. Cheers to all of you.