×

Search anything:

df command in Linux

Binary Tree book by OpenGenus

Open-Source Internship opportunity by OpenGenus for programmers. Apply now.

The df command displays information related to file systems such as total space, used space, mount point and much more. In this article we discuss the output of this command, various options and commonly used commands using df.

Table of contents.

  1. Introduction.
  2. Syntax.
  3. Commands.
  4. Summary.
  5. References.

Introduction.

The df command is used to show information related to file systems, e.g total space or available space.

It is one of the Linux tools used for checking disk space utilization.

Syntax.

The syntax is as follows,

df [OPTION]... [FILE]...

Commonly used options include,

  • -a, used to include pseudo, duplicate or inaccessible file systems.
  • -h, to display sizes in powers of 1024 (e.g., 1023M) which can be easily read.
  • -H, to display sizes in powers 1000 (e.g., 1.1G)
  • -T, to include the type of file system in the output.
  • -t, to display specified file systems.
  • -x, to exclude the specified file systems.
  • -i, to list inode information instead of block usage.
  • -k, to display the statistics in kilobytes.
  • -m, to display the statistics in megabytes.

Commands.

To list the type of file systems.

df -T

From output we have,

  • Filesystem, which is the name of the disk partition.
  • Type, which describes the type of the file system, ext4, btrfs etc.
  • 1K-blocks, represents the total size of the file system.
  • Used, represents the amount of space allocated to existing files in the file system.
  • Available, represents the available space within the file system.
  • Use%, represents the percentage of available space that is currently allocated to all files in the file system.
  • Mounted on, is the the directory on which the file system is mounted on.

To list ext4 file systems, write,

df -t ext4

To list all file systems except ext4 file systems, write,

df -T -x ext4

To list inode information we use the -i option,

df -i

From the output we also get the IUsed, IFree and IUse% columns.

To list the statistics in gigabytes or human-readable form, write,

df -h

To list statistics in megabytes,

df -m

To list statistics in kilobytes, write,

df -k

To display information such as the file system, blocks, used, available and mont point for a specific directory, write,

df Documents

Options such as -i, -T and others can also be applied here to produce a desired output.

Summary.

The df(disk filesystem) command is used to check disk space utilization in Linux.
To list the types of file systems we use the -T option.

We have discussed the meaning of the output produced when df command is executed.

References.

  1. Execute df --help for other options or man df for manual page.
df command in Linux
Share this