Df Command in Linux - How is works ?

The df command (short for disk free), is used to display information related to file systems about total space and available space on the drive.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux System commands queries.

In this context, we shall look into how to use the df command in Linux.

What is the df command Syntax in Linux?

The df command takes the following format:

$ df [options]... filesystem…

The [options], is explained below.

1. -h display size in human-readable format:

$ df -h

2. -a show information of all file system disk space usage:

$ df -a

3. -k show information of the file system in Bytes:

$ df -k

4. -m show information of the file system in MB:

$ df -m

5. -i display file system inodes:

$ df -i

6. -T display type of file system:

$ df -T

7. -t show information of certain file.

for example, to display ext4 system, simply execute the command:

$ df -t ext4

8. -x exclude information of certain files.

For example, If you do not want to display ext4 system, run the command:

$ df -x ext4

9. If you use df command without [options], it will display all the information of the mounted file systems

[Need assistance in Installing Open Source Software on Ubuntu Linux System ? We can help you. ]

This article covers how to use the df command in Linux. You can use the df command when you need to know how much space is available on a particular file system or to see an overview of mounted files systems.

If you want to display all the file system, use -a option:

df -a

Options for df command includes:

  • -a, –all : includes pseudo, duplicate and inaccessible file systems.
  • -B, –block-size=SIZE : scales sizes by SIZE before printing them.
  • -h, –human-readable : print sizes in power of 1024.
  • -H, –si: print sizes in power of 1000.
  • -i, –inodes : list inode information instead of block usage.
  • -l, –local : limit listing to local file systems.
  • -P, –portability : use POSIX output format.
  • –sync : invoke sync before getting usage info.
  • –total : elide all entries insignificant to available space, and produce grand total.
  • -t, –type=TYPE : limit listing to file systems of type TYPE.
  • -T, –print-type : print file system type.

Related Posts