Do you use Linux? If so, then you know that it is a powerful operating system with a lot of tools and options to help you manage your system. One of the most useful tools that Linux provides is the df command, which allows you to check your disk space. In this blog, we will take a look at how to use the df command to check your disk space in Linux.

Advertisement

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:

df 

Filesystem     1K-blocks     Used   Available Use% Mounted on
/dev/sda1       81120644 74228852   6875408  92% /
tmpfs            4074140        0   4074140   0% /dev/shm

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:

df -T /dev/sda1 
du Command in Linux (Check Disk Space)
du -T command output

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.

df -hT /dev/sda1 
du -hT command output

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:

du [options] [files]

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.

Share.
Leave A Reply

Exit mobile version