Home > Package & System Management > df

df: Check Disk Space Usage

The df command reports the disk space usage of file systems. It displays the total space, used space, available space, and usage percentage in a human-readable format, helping system administrators quickly assess disk status.

Overview

df stands for 'disk free' and shows the total disk space, used space, available space, and usage percentage of mounted file systems. Using it with the -h option is particularly convenient as it displays capacities in human-readable units (KB, MB, GB).

Key Features

  • Reports disk usage per file system
  • Human-readable capacity display (-h)
  • Displays file system type (-T)
  • Checks inode usage (-i)

Key Options

The df command allows you to adjust the output format and filter specific information through various options.

Display Format and Information

Generated command:

Try combining the commands.

Description:

`df` Executes the command.

Combine the above options to virtually execute commands with AI.

Usage Examples

Common usage examples for the df command.

Check Disk Usage in Human-Readable Format

df -h

The most common usage, displaying disk space in easily readable units.

Check Disk Usage with File System Type

df -Th

Displays the type of each file system (e.g., ext4, xfs) for more detailed information.

Check Inode Usage

df -ih

Checks the usage and availability of inodes instead of disk space. A lack of inodes can prevent file creation even if disk space is available.

Check Usage of a Specific File System

df -h /home

Checks the usage of the file system that a specific mount point or directory belongs to.

Display Only Specific File System Types

df -h -t ext4

For example, displays only ext4 file systems.

Tips & Notes

Useful tips and points to note when using the df command.

Difference Between df and du

df reports the available space for the entire file system, whereas du (disk usage) reports the space occupied by specific directories or files. df calculates in block units and may not reflect space occupied by deleted but still open files.

Interpreting Output

The meaning of each column in the df output is as follows:

  • Filesystem: The name of the file system or the mounted device.
  • Size: The total capacity of the file system.
  • Used: The currently used space.
  • Avail: The space available for new files to be saved by users. (Typically excludes space reserved for the root user)
  • Use%: The percentage of used space. A high percentage may indicate a disk space shortage.
  • Mounted on: The directory path where the file system is mounted.

Default Installation

The df command is included by default in most Linux distributions, so no separate installation is required.


Same category commands