df Command in Linux (original) (raw)

Last Updated : 14 May, 2026

The df command in Linux is used to display disk space usage of mounted file systems. It provides information about total space, used space, available space, and the percentage of usage for each file system.

Example 1: Display Disk Usage of All Mounted File Systems

**Command:

df

**Output:

df

Output

Example 2: Check Disk Usage of a Specific Directory

**Command:

df /home

**Output:

df-home

Output

Syntax:

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

Using df for a Specific File

Suppose we have a file named sample.txt and want to check its file system usage:

**Command:

df sample.txt

**Output:

df-sample

Output

options of 'df' command

1. -a, --all

Displays all file systems, including special or dummy file systems that have zero block sizes (e.g., proc, sysfs).

**Syntax:

df -a

**Output:

df-a

Output

2. -h, --human-readable

Displays disk usage in human-readable format (KB, MB, GB) instead of default 1K blocks, making it easier to understand.

**Syntax:

df -h

**Output:

df-h

Output

3. -i, --inodes

Displays inode usage instead of disk space. Inodes are data structures that store information about files (like metadata).

**Syntax:

df -i

**Output:

df-i

Output

4. --total

Displays a grand total of disk space for all listed file systems. Adds an extra row at the bottom summarizing total size, used space, and available space.

**Syntax:

df --total

**Output:

df-total

Output

5. -t TYPE

Displays disk usage only for file systems of a specific type. Filters output by file system type, such as ext4, xfs, tmpfs, or squashfs.

**Syntax:

df -t TYPE

**Example:

Display Only tmpfs File Systems

**Command:

df -t tmpfs

**Output:

df-t-type

Output

6. -x TYPE

Excludes file systems of a specific type from the output. Opposite of -t.

**Syntax:

df -x TYPE

**Example:

Exclude tmpfs File Systems

**Command:

df -x tmpfs

**Output:

df-x-type

Output

7. --sync

Ensures that df reports up-to-date disk usage by running the sync system call before gathering information.

**Syntax:

df --sync

**Example:

Display Disk Usage with Sync

**Command:

df --sync

**Output:

df-sync

Output

8. -l, --local

Displays only local file systems, excluding network-mounted file systems like NFS or Samba. Used to focus on disks physically attached to the system.

**Syntax:

df -l

**Example:

Display Only Local File Systems

**Command:

df -l

**Output:

df-l

Output

9. -T, --print-type

Displays the type of each file system along with disk usage. Shows whether a file system is ext4, xfs, tmpfs, squashfs, etc.

**Syntax:

df -T

**Output:

df-T

Output