Best useful Linux DF command with examples

In this article, we’ll look at the df command on Linux. The df command (also known as “Disk Free”) is a command for Linux and Unix operating systems that is used to check disk space / disk usage. Not only is the df command for disk space useful for more than that.

Best useful DF command with examples

You can use the Linux df command to get the following information about disks and partitions:

  • partition name
  • Total size of the partition in different units like GB. MB. KB. blocks…Etc..
  • Storage space used
  • Available storage space
  • Percentage of space used
  • Mounting position
  • Partition file system
  • Partition inode information

Use the following command to check the installed df command package version.

[[email protected] ~]# df --version  # Checking df command Package Version
df (GNU coreutils) 8.4
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later .
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjörn Granlund, David MacKenzie, and Paul Eggert.

How to check disk usage information like Space used. Available space. Percentage used. Mounting position we can use df Command.

[[email protected] ~]# df   # Checking disk usage Information
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda2       18339256 2465648  14942024  15% /
tmpfs             506176     224    505952   1% /dev/shm
/dev/sda1         297485   34634    247491  13% /boot

Df command with argument -on Displays information about all available file systems, including dummy file systems.

[[email protected] ~]# df -a   # Showing all available Disk Usage Information
Filesystem       1K-blocks    Used Available Use% Mounted on
/dev/sda2         18339256 2465648  14942024  15% /
proc                     0       0         0    - /proc
sysfs                    0       0         0    - /sys
devpts                   0       0         0    - /dev/pts
tmpfs               506176     224    505952   1% /dev/shm
/dev/sda1           297485   34634    247491  13% /boot
none                     0       0         0    - /proc/sys/fs/binfmt_misc
vmware-vmblock           0       0         0    - /var/run/vmblock-fuse
gvfs-fuse-daemon         0       0         0    - /root/.gvfs

You can use the df command with the argument -H Check disk usage in human-readable format.

[[email protected] ~]# df -h  # Checking Disk Usage in Human Readable Format
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        18G  2.4G   15G  15% /
tmpfs           495M  224K  495M   1% /dev/shm
/dev/sda1       291M   34M  242M  13% /boot

You can check the disk usage of a particular mount point by using the Linux df command with the mount point. See the following command.

[[email protected] ~]# df -h /boot/  # Checking Disk Usage of a Particular Mount Point
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       291M   34M  242M  13% /boot

You can also check the disk usage of a particular partition by using the df command with the partition name. See the following command,

[[email protected] ~]# df /dev/sda2   # Checking Disk Usage of a Particular Partition
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda2       18339256 2597164  14810508  15% /

Df command with argument -BM prints the storage space in MB (megabytes).

[[email protected] ~]# df -BM   # Checking Disk Usage in MB (Megabyte) 
Filesystem     1M-blocks  Used Available Use% Mounted on
/dev/sda2         17910M 2408M    14592M  15% /
tmpfs               495M    1M      495M   1% /dev/shm
/dev/sda1           291M   34M      242M  13% /boot

Linux df command with argument -BG prints the storage space in GB (gigabytes).

[[email protected] ~]# df -BG  # Checking disk usage in GB (Gigabyte)
Filesystem     1G-blocks  Used Available Use% Mounted on
/dev/sda2            18G    3G       15G  15% /
tmpfs                 1G    1G        1G   1% /dev/shm
/dev/sda1             1G    1G        1G  13% /boot

Df command with argument -BK prints the storage space in KB (kilobytes).

[[email protected] ~]# df -BK  # Checking Disk Usage in KB (KiloByte)
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda2      18339256K 2465640K 14942032K  15% /
tmpfs            506176K     224K   505952K   1% /dev/shm
/dev/sda1        297485K   34634K   247491K  13% /boot

OR you can use the following command to get the same result. Df command with argument -k also prints disk usage in KB.

[[email protected] ~]# df -k  # Checking Disk Usage in KB
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda2       18339256 2465644  14942028  15% /
tmpfs             506176     224    505952   1% /dev/shm
/dev/sda1         297485   34634    247491  13% /boot

As we know it 1024 MB = 1 GB, Typically, the df command calculates disk usage only in this way. But if you use linux df command with argument -H than in this case, df calculates and prints the disk allocation in Powers of 1000 instead of 1024.

[[email protected] ~]# df -H  # Checking Disk Usage in Powers of 1000 Instead of 1024
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        19G  2.6G   16G  15% /
tmpfs           519M  230k  519M   1% /dev/shm
/dev/sda1       305M   36M  254M  13% /boot

To check the hard drive’s inode information, you can use the df command with an argument -I, Here you can get information like Inode Total number of inodes. Used inodes. Available inodes and so on.

[[email protected] ~]# df -i   # Checking Inode Information
Filesystem      Inodes IUsed   IFree IUse% Mounted on
/dev/sda2      1164592 96621 1067971    9% /
tmpfs           126544     5  126539    1% /dev/shm
/dev/sda1        76912    38   76874    1% /boot

Df command with argument -T prints the partition’s file system type.

[[email protected] ~]# df -T  # To check the Filesystem type of the Partition
Filesystem     Type  1K-blocks    Used Available Use% Mounted on
/dev/sda2      ext4   18339256 2504068  14903604  15% /
tmpfs          tmpfs    506176     228    505948   1% /dev/shm
/dev/sda1      ext4     297485   34634    247491  13% /boot

For more information and arguments about the Linux df command, you can use the following command.

[[email protected] ~]# df --help   # For df command related HELP
Usage: df [OPTION]... [FILE]...
Show information about the file system on which each FILE resides,
or all file systems by default.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all             include dummy file systems
  -B, --block-size=SIZE  use SIZE-byte blocks
      --direct          show statistics for a file instead of mount point
      --total           produce a grand total
  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
  -H, --si              likewise, but use powers of 1000 not 1024
  -i, --inodes          list inode information instead of block usage
  -k                    like --block-size=1K
  -l, --local           limit listing to local file systems
      --no-sync         do not invoke sync before getting usage info (default)
  -P, --portability     use the POSIX output format
      --sync            invoke sync before getting usage info
  -t, --type=TYPE       limit listing to file systems of type TYPE
  -T, --print-type      print file system type
  -x, --exclude-type=TYPE   limit listing to file systems not of type TYPE
  -v                    (ignored)
      --help     display this help and exit
      --version  output version information and exit

Display values are in units of the first available SIZE from --block-size,
and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

SIZE may be (or may be an integer optionally followed by) one of following:
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.

Report df bugs to [email protected]
GNU coreutils home page: 
General help using GNU software: 
For complete documentation, run: info coreutils 'df invocation'

OR you can use the following command.

[[email protected] ~]# man df  # Linux df command help page

Also Read – Useful Linux Fdisk Command with Examples – A Linux Partition Tool

That’s all. In this article, we explained Best Useful DF command With examples. I hope you like this article. If you like this article, just share it. If you have any questions about this article, please comment.

Sidebar