Even if your hard disk has a lot of storage space, you should always check how much of it you’ve used and which files take up the most space.

Keeping a close eye on your disk space usage is vital to using any computer, tablet, laptop, or smartphone. Monitoring free storage space is crucial for the continued health of any device. This alerts you if your disk space is getting low and helps you determine which applications or programs are hogging the most room on your dedicated server.

Like other operating systems, Linux gives you a choice of the command line (CLI) and graphical user interface (GUI) tools to monitor disk usage. However, the command line is where most work gets done on Linux. As a result, ways of verifying disk space via the command line will likely be of greater relevance to Linux users. This article will focus exclusively on command-line approaches to checking disk usage Linux.

Evaluating Linux’s Disk Space Via the Command Line

There are several methods for doing so with Linux, but we’ve included the most efficient ones that use the command line interface.

Method 1: The df Command

The df command, short for “Disk Filesystem,” is a standard part of every distribution of Linux. Disk space availability and usage can be tracked with the df command. Here’s how to use this program to see how much storage is left on your disk:

To get started with the terminal in Linux Mint 20, click on its desktop icon, as seen in the image below:

If you’re using Linux Mint 20, open the terminal and type the following command:

When you use this command, you’ll see details like the size of your whole file system, how much of that space is being used, how much is still available, and more.

Method 2: Utilizing the df command with the -a flag

The df displays the total amount of disk space occupied by all file systems when the a-flag command is used (i.e., your actual file system and the dummy ones). The df command’s -a flag requires the following actions to be taken:

Open the Linux Mint 20 terminal and type in the following command:

This command produces a vast amount of output; you must scroll your terminal to see it all. That’s because the -a flag doesn’t only print the storage capacity of one file system; it also prints the disk space of every file system.

df-command

Method 3: Utilizing the df command with the -h flag

There are likely to be a few technical words that are difficult to comprehend for a new user. For instance, you will notice that the outputs of both of the algorithms we just went over contain a column labeled “1K-blocks.” This column displays the total number of “1K-blocks” that can be found in each of the file systems. In other words, this is the file system’s size measured in bytes, which might be a challenging unit to decipher and commit to memory. Simply put, it is a technical method of displaying the size of each file system, but for the average person, this might not make a lot of sense. Therefore, if you want the disk space to be displayed in a format that is easier for humans to understand, you can use the -h flag with the df command. To make this occur, carry out the actions outlined below:

After you have successfully started the Linux Mint 20 terminal, as shown earlier, proceed to run the following command:

When you run this command, the available space on the disks of your file system will be shown in a format that is easy for you to understand; specifically, the available space will be presented in units such as megabytes (MB), gigabytes (GB), and so on. This result is depicted in the image that can be found below:

Similarly, you may use the -k and -m parameters with the df program to examine the disk space in Linux via the command prompt in kilobytes and megabytes, respectively. This can be done in either of those units. If you need disk space in a particular unit for a specific reason, you can do this if the unit supports the feature. Checking the amount of space on your drive can be done in whichever format is most convenient for you, and the df command or program enables you to do so in this manner.

This article covered the command-line procedure for doing just that in Linux. Each proposed solution was just a special case of the df command. Adjusting the flags of the df tool to your needs makes it simple to examine disk space in Linux from the command line. However, you can use these commands without any additional parameters. These commands will show you disk usage in Linux and how much is available on your drive.

If you want to know more about basic Linux commands, you can check out our other blog posts.