Linux df Command: Check Filesystem Free Space
df shows the total size, usage, and available space for each mounted file system. It is used to check if the disk is full, and its scope is different from du, which calculates capacity per directory.
What is the df command?
df reads the space statistics of the file system instead of summing up individual files. Avail indicates the space available to the general user, and if there are reserved blocks, it may not exactly match the value of total size minus used space. Even if there is block space remaining, if inodes run out, new files cannot be created.
Basic syntax
df [options] [file or mount point]
The installed implementation and options may vary depending on the distribution. Check the description for the current system with man df.
Examples
Total file system capacity
Check the mounted file systems in human-readable units.
df -h
File system of a specific path
Check the available space of the file system to which the specified path belongs.
df -h /var
inode usage
If there is space left but file creation fails, check for inode exhaustion.
df -i /var
Reading File System Usage
df shows the space of the file system that the path belongs to, not the size of a single file. If you specify only the root path, you can narrow the scope to the related mount entries.
df -h /
Example output (capacity and device names vary by environment):
Filesystem Size Used Avail Use% Mounted on /dev/sda2 40G 18G 20G 48% /
Avail is the space available to regular users and may not equal Size - Used due to reserved blocks on the file system. If df shows full but the total file size seems small, check for files that have been deleted but are still open by processes, or other mounted or reserved areas. Disk usage by directory is handled by du.
Main Options and Format
| Options/Format | Description |
|---|---|
-h |
Display sizes in human-readable units. |
-T |
Display the filesystem type as well. |
-i |
Display inode usage instead of blocks. |
-t format |
Only display the specified filesystem type. |
--output=fields |
Select the required output columns. |
Precautions when using
On network, container, and overlay file systems, the same storage space may appear in multiple rows. If the df and du results differ, check for deleted files that processes still have open, reserved blocks, snapshots, etc. Do not assume fixed column positions in automation for default output.
Frequently Asked Questions
Why do df and du show different values?
df reports overall file system space statistics, while du sums up the usage of accessible files and directories. Open deleted files, etc., can cause differences between the two results.
Official Documentation
For the exact behavior of options and implementation-specific differences, see the official df documentation.









