Bootstrap FreeKB - Linux Commands - df command (disk filesystem usage)
Linux Commands - df command (disk filesystem usage)

Updated:   |  Linux Commands articles

The df command without any options can be used to list the total size, used space, available space, percentage used, and mounted file system.

df

 

Something like this should be returned. By default, the values are listed in 1K-blocks (kilobytes). 

Filesystem                           1K-blocks     Used Available Use% Mounted on
/dev/sda1                               372607   170989    177862  50% /boot
/dev/sda2                               129774     6994    122780   6% /opt

 

The -h or --human-readable flag can be used to display the size in bytes, kibites, mibites or kibites (not kilobytes, megabytes, or gigibytes).

df -h

 

Something like this should be returned.

Filesystem                            Size  Used Avail Use% Mounted on
/dev/sda1                             364M  167M  174M  50% /boot
/dev/sda2                             127M  6.9M  120M   6% /opt

 

Or, the -B or --block-size option can be used to return the output in one of the following formats.

  • kibibyte (k or KiB) - 1024 bytes
  • kilobyte (K or KB) - 1000 bytes
  • mebibyte (m or MiB) - 1024 kibibytes
  • megabyte (M or MB) - 1000 kilobytes
  • gibibyte (g or GiB) - 1024 mebibytes
  • gigabyte (G or GB) - 1000 megabytes
  • tebibyte (t or TiB) - 1024 gibibytes
  • terabyte (T or TB) - 1000 gigabytes
  • pibibyte (p or PiB) - 1024 tebibytes
  • petabyte (P or PB) - 1000 gigabytes
  • exbibyte (e or EiB) - 1024 pibibytes
  • exabyte (E or EX) - 1000 petabytes

 

Notice in this example that the 1K-blocks value is 20,961,280 (kibibyte).

~]$ df --block-size K
Filesystem                  1K-blocks     Used  Available  Use%  Mounted on
/dev/mapper/rootvg-lv_home   20961280  6299796   14661484  31%   /home

 

Or, in this example that the 1kB-blocks value is 21,464,351 (kilobytes).

~]$ df --block-size KB
Filesystem                  1kB-blocks       Used   Available  Use%  Mounted on
/dev/mapper/rootvg-lv_home  21464351kB  6450992kB  15013360kB   31%  /home



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 0b7759 in the box below so that we can be sure you are a human.