df
Command: Disk Space Analyzer
Summary
The df
command displays the amount of disk space available on file systems. It's a quick way to check how much free space you have.
Introduction
The df
(disk free) command is a fundamental Linux utility used to report file system disk space usage. It shows the amount of disk space used and available for each mounted partition. This information is critical for system administrators and users alike to monitor storage and prevent issues related to full disks.
Use case and Examples
Basic Usage: Display disk space for all mounted file systems
This command will output a table showing the file system, size, used space, available space, used percentage, and mount point for each mounted file system.Display disk space in human-readable format (e.g., KB, MB, GB)
This is often the preferred way to usedf
as it makes the output easier to understand. Display disk space for a specific file system
This command will only show the disk space usage for the file system where the/home
directory is located. Display disk space in inodes instead of blocks
This will show the number of inodes used and available on each file system. Inodes are data structures used to represent files in the file system. Running out of inodes can prevent you from creating new files, even if you have free disk space.Display disk space for all file systems including pseudo, duplicate, inaccessible file systems
This command is useful for a complete overview, including system-related file systems that might not be obvious in the standard output.Commonly used flags
Flag | Description | Example |
---|---|---|
-h | Displays sizes in a human-readable format (e.g., KB, MB, GB). | df -h |
-i | Displays inode information instead of block usage. | df -i |
-T | Displays the file system type. | df -T |
-a | Includes all file systems, even those that are pseudo or inaccessible. | df -a |
-k | Displays sizes in kilobytes. | df -k |
-m | Displays sizes in megabytes. | df -m |
-B, --block-size=SIZE | Use SIZE-byte blocks | df -B 2048 |