df Command – Check Disk Space in Linux
The df
command is a Linux utility that displays information about disk space usage on the system. When used without any options, df shows the amount of available disk space on all mounted file systems.
Here is an example of the df
command:
The output shows the file system name (e.g., /dev/sda1
), the total size of the file system in 1K blocks, the amount of space used, the amount of available space, and the percentage of space used. The last column shows the mount point for the file system.
You can use the following options with the df
command:
-a
: Shows information about all file systems, including those that have 0 blocks. -h
: Shows the sizes of file systems in “human-readable” format (e.g., in MB or GB). -i
: Shows the number of inodes (files and directories) on the file system. -T
: Shows the type of the file system. -x
: Exclude a specific file system from the output.
If you want to check the disk space for a specific filesystem, you can use the -T option. This will show you the total size, used space, and free space for the specified filesystem. For example, to check the disk space for the /dev/sda1
filesystem, you can run the following command:
You can also use the -h
option to get the output in a more human-readable format. This will show the size of the filesystem in kilobytes, megabytes, or gigabytes, rather than in bytes.
How to Check Available Disk Space with Other Linux Commands
The df command is not the only way to check disk space in Linux. There are a number of other commands that you can use to check disk space.
The du command is a useful tool for checking disk usage. The syntax for this command is as follows:
This command will show you how much disk space is being used by a particular file or directory. You can also use the -h
option to get the output in a more human-readable format.
Another useful command is the df -i
command. This command will show you the number of inodes available on the filesystem. Inodes are used to store information about files, such as their size and permissions.
Finally, the df -m
command will show you the amount of available memory on the system. This is useful for checking how much memory is available for applications.
Conclusion
In this blog, we have taken a look at how to use the df command to check your disk space in Linux. We have also looked at some of the options that you can use to customize the output, as well as some other commands that you can use to check disk space. Using the df command is a great way to keep track of your disk space in Linux. It is a powerful tool that can help you manage your system and make sure that you are not running out of disk space. So, the next time you need to check your disk space in Linux, make sure to use the df command. I hope you found this blog to be helpful. If you are looking for more information on Linux, then be sure to check out our list of the Top 10 Best Linux Desktop Distributions.