Linux df Command Guide: Monitor Disk Space Usage
The df (disk free) command is a core utility in the
Linux operating system used to analyze and monitor filesystem disk space
usage. This article explains the primary purpose of the df
command, breaks down its essential flags, and demonstrates how system
administrators rely on it to track storage capacity, prevent outages,
and maintain system health.
The Purpose of the
df Command
The primary purpose of the df command is to report the
amount of available and used disk space on mounted filesystems. When
managing a Linux system, running out of disk space can cause critical
services to crash, prevent log generation, and corrupt databases. The
df command provides immediate visibility into storage
consumption, allowing administrators to proactively manage drive
capacity and troubleshoot storage-related bottlenecks.
Essential df Command
Options
By default, running df outputs values in 1-kilobyte
blocks, which can be difficult to read. Several flags make the output
clear and actionable:
df -h(Human-Readable): Converts block sizes into easily readable units, such as Megabytes (M) and Gigabytes (G).df -T(Filesystem Type): Adds a column displaying the filesystem type (e.g., ext4, xfs, btrfs), which helps identify how different partitions are formatted.df -i(Inode Usage): Displays the number of used and free inodes instead of block usage. A disk can run out of inodes if it contains millions of tiny files, preventing new files from being created even if physical disk space remains available.df -t [type](Filter by Type): Limits the output to specific filesystem types, filtering out temporary or virtual filesystems liketmpfs.
Understanding the Output
When you execute df -h, the terminal generates a table
with six standard columns:
- Filesystem: The name of the storage partition or
network drive (e.g.,
/dev/sda1). - Size: The total capacity of the filesystem.
- Used: The total amount of space currently occupied by files and directories.
- Avail: The remaining space available for unprivileged processes.
- Use%: The percentage of storage currently utilized.
- Mounted on: The mount point directory where the
filesystem is attached within the Linux directory tree (e.g.,
/,/home, or/var).
Why df Is
Critical for System Monitoring
In modern system administration, the df command serves
as both an interactive diagnostic tool and an automated monitoring
component. Shell scripts and monitoring agents (such as Prometheus,
Nagios, or Zabbix) frequently run df in the background to
poll storage statistics. By setting threshold alerts—such as notifying
administrators when Use% exceeds 85%—teams can resolve
storage constraints before they lead to service interruptions.