Linux disk usage is one of the critical information for a Linux Administrator. A Linux admin generally use different commands to check Linux disk usage and memory availability. In this lesson, we will focus on these commands and learn how to check Linux disk utilization. So, how to check Linux disk space? Let’s see alternative commands to check Linux disk space
You can also check Linux Cheat Sheet for More Linux Commands!
The first answer of how to check Linux disk space question is Linux df command. With df command, which we can check Linux disk usage quickly. We can use this command without any option. By the way, df is the abbreviation for “disk free”.
Beside using df command alone, we can also use some options with it to learn more information about Linux disk usage. For example, if we use -T option, as df -T, we can also learn filesystem type of (xfs, ext2, ext3, ext4, etc.) each block.
Another option is df -a. With this option, we can learn disk usage for all files, also the files whose available field is 0.
And the other one is -I option which shows used and free inodes space.
We can also use –h option to display the information with a human readable format.
The second answer of how to check Linux disk space question is, using linux du command. With du command of Linux, we can display disk usage of files and folders.
If you would like to display disk usage for all the files, you can use, as du -a.
Option -s shows the total disk usage by a particular file or directory in the Linux system.
If you would like to learn each file’s modification time in Linux system, you can use du –time option.
Another command to check linux disk usage is Linux free command. This command displays the amount of free/used disk space as memory and swap in Linux system. We can use linux free command alone to display disk usage. We can also use different options for alternative views.
First of all, we can use -h option for human readable format. This command will show disk usage with better view for us.
Above, the output of the command is in Mebibyte format. If you would like to see the result in megabytes, you can use –mega option with free command. Or you can use –giga to is it in gigabytes.
Sometimes you can want to display disk usage, a couple of times. For this check, you can use free -c option. After this command, you should define the times that you would like to display this command. Below, we will display Linux disk usage, three times.
If a couple of times is not enough for you, you can refresh free command at a given interval. To do this, you can use free -s option. With the below command, the output of free command will be displayed every two seconds. If you would like to break, you can use CTRL-C and quit.
We can also use -l option to show low and high memory statistics on the system.
And lastly, with -t option, we can see the total of each column. Memory and swap totals.
Another command to display information about Linux disk space is fdisk command. With fdisk command, we can display the partition on Linux system and the details about it. We will use -l option with this command.
Another command to display information about disks is sfdisk. Again, we will use sfdisk command with -l option.
If you would like to use a Linux partition editor, Linux cfdisk command is for you. With this editor, you can create, modify and manage partitions.
If you want to work with a specific partition, you can define it after cfdisk command like below:
With Linux parted command, we can display and modify partition in Linux system. We can use this command with -l option.
With lsblk command of Linux, we can list the storage blocks, partitions etc. This command gives the total size but not the used space by these partitions.
With blkid command, we can print partitions again. Anad again like lsblk command, blkid command do not print the used size by partition.
In Linux, disk usage is very important. Linux system administrators always check this information for a good system performance. For Linux disk usage, system administrators use generally du, df, free commands. Beside these commands, there are other alternatives. In this lesson, we have answered, how to check Linux disk space question with nine different disk usage Linux commands.