df

system managementLinux/Unix
The df command is one of the most frequently used commands in Linux/Unix-like operating systems. df Report file system disk space usage

Quick Reference

Command Name:

df

Category:

system management

Platform:

Linux/Unix

Basic Usage:

df -h

Common Use Cases

  • 1

    Disk space monitoring

    Check available disk space on mounted filesystems

  • 2

    Storage management

    Identify filesystems that are running low on space

  • 3

    System administration

    Monitor disk usage across multiple partitions and drives

  • 4

    Capacity planning

    Plan storage upgrades based on current utilization

Syntax

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

Options

Option Description
-a, --all Include empty, dummy, and inaccessible filesystems
-B, --block-size=SIZE Scale sizes by SIZE before printing (e.g., 'K' for kilobytes)
-h, --human-readable Print sizes in human-readable format (e.g., 1K, 234M, 2G)
-H, --si Print sizes in powers of 1000 instead of 1024
-i, --inodes List inode information instead of block usage
-k Like --block-size=1K
-l, --local Limit listing to local filesystems
-t, --type=TYPE Limit listing to filesystems of type TYPE
-T, --print-type Print filesystem type
-x, --exclude-type=TYPE Exclude filesystems of type TYPE
--help Display help information
--version Display version information

Examples

How to Use These Examples

The examples below show common ways to use the df command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

# Basic Examples Basic
df
Display disk space usage for all mounted filesystems.
df -h
Show disk space usage in human-readable format (KB, MB, GB).
df /home
Show disk space usage for the /home filesystem. # Advanced Examples Advanced df -i Display inode usage instead of block usage. df -T Show filesystem types along with disk space information. df -x tmpfs -x devtmpfs Exclude temporary filesystems from the report. df --output=source,target,fstype,used,avail,pcent Customize output columns. df -h | sort -k 5 -hr Sort filesystems by usage percentage (highest first).

Try It Yourself

Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

Understanding Syntax

Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

Notes

The df (disk free) command is one of the most frequently used commands for checking disk space usage on Linux and Unix-like systems. By default, df displays: - Filesystem: The name of the mounted device or partition - Size: Total size of the filesystem - Used: Space used - Available: Space available - Use%: Percentage of space used - Mounted on: Mount point The most common usage is with the -h option, which makes the output human-readable with units like KB, MB, and GB. When a file is specified as an argument, df reports on the filesystem that contains that file. It's important to understand that df reports the space from the filesystem's perspective, which might differ from what you see with commands like du in certain cases (such as with deleted but still open files). For monitoring inode usage (which can be a bottleneck when dealing with many small files), use the -i option. System administrators often combine df with grep to monitor specific filesystems: df -h | grep /home A full filesystem (especially the root filesystem) can cause serious system problems, so regularly monitoring with df is recommended as part of system maintenance.

Tips & Tricks

1

Use the -h option to display sizes in human-readable format

2

Use the -i option to display inode information

3

Use the -T type option to limit the output to specific filesystem types

4

Use the -x type option to exclude specific filesystem types

5

Use the -a option to include all filesystems

Common Use Cases

Disk space monitoring

Check available disk space on mounted filesystems

Storage management

Identify filesystems that are running low on space

System administration

Monitor disk usage across multiple partitions and drives

Capacity planning

Plan storage upgrades based on current utilization

Quota enforcement

Verify if users or applications are approaching storage limits

Related Commands

These commands are frequently used alongside df or serve similar purposes:

Use Cases

1

Disk space monitoring

Check available disk space on mounted filesystems

2

Storage management

Identify filesystems that are running low on space

3

System administration

Monitor disk usage across multiple partitions and drives

4

Capacity planning

Plan storage upgrades based on current utilization

5

Quota enforcement

Verify if users or applications are approaching storage limits

Learn By Doing

The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the df command works in different scenarios.

$ df
View All Commands