The df
command in Linux is used to display information about the file system usage on a particular file system or on all mounted file systems. The df
command shows the amount of disk space that is used, available, and total, as well as the file system type and its mount point.
Here’s an example of how to use the df
command:
$ df -h
The -h
option shows the disk space information in a human-readable format, which is easier to understand than the default format that shows the space in bytes. The output of the command may look like this:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 20G 8.2G 12G 42% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sdb1 50G 25G 23G 53% /home
s
In this example, the df
command shows the usage information for all mounted file systems. The first column shows the file system name or device, followed by the total size, used space, available space, and percentage of space used. The last column shows the mount point of the file system.
By default, df
shows disk space in 1K blocks, but you can use the -h
option to display the information in human-readable format, which shows the disk space in megabytes (MB) or gigabytes (GB) depending on the size of the file system.