df Command in Linux: Disk Space, Inodes & Real Fixes

sudo df -BG

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 696G 321G 339G 49% /
efivarfs 256K 49K 203K 20% /sys/firmware/efi/efivars
/dev/sda2 286M 6.2M 280M 3% /boot/efi
/dev/sdb3 274G 2.9G 258G 2% /media/ravi/Personal_Sites
/dev/sdb1 229G 211G 6.0G 98% /media/ravi/Personal_Data
/dev/sdb2 458G 74G 361G 17% /media/ravi/Linux_VM

12. Show Custom Output Columns

For related disk management tools, see:
df -ih

sudo df

Show Linux Disk Space Usage
Show Linux Disk Space Usage

Use df first to identify which partition is the problem, then use du command to drill down into what is causing it.

df Command Syntax

Check inodes first:
df -t xfs -h

11. Check Linux File System Type

If your immediate problem is a full disk and you need to find what’s eating space, pair df -h with du -sh /* | sort -rh | head -20 to quickly identify the largest directories.

2. Show Disk Space in Human-Readable Format (The One You’ll Use Most)

# Find processes holding deleted files open
lsof +L1 | grep /var

It also shows pseudo filesystems like tmpfs, sysfs, proc, and devtmpfs – which normally show 0 blocks and are hidden by default.
df -h shows /var at 99%, but du -sh /var/* shows only 10GB used. This classic mismatch usually means a deleted file is still held open by a running process — the space won’t be freed until that process closes or restarts.

3. Show All Filesystems Including Pseudo Filesystems

df -h / /home /var

6. Check Disk Space Usage in Kilobytes

In this guide, we’ll go beyond the basic flags and show you how to actually read df output, combine options for more useful results, and catch disk space problems before they cause downtime.
df -h –output=source,fstype,size,used,avail,pcent,target

Filesystem Size Used Avail Use% Mounted on
tmpfs 3.2G 2.6M 3.2G 1% /run
/dev/sda1 696G 321G 339G 49% /
tmpfs 16G 861M 15G 6% /dev/shm
tmpfs 5.0M 12K 5.0M 1% /run/lock
efivarfs 256K 49K 203K 20% /sys/firmware/efi/efivars
tmpfs 16G 0 16G 0% /run/qemu
/dev/sda2 286M 6.2M 280M 3% /boot/efi
tmpfs 3.2G 156K 3.2G 1% /run/user/1000
/dev/sdb3 274G 2.9G 258G 2% /media/ravi/Personal_Sites
/dev/sdb1 229G 211G 6.0G 98% /media/ravi/Personal_Data
/dev/sdb2 458G 74G 361G 17% /media/ravi/Linux_VM

df -t ext4 -h

df -ih /var

The command "df -a" is used to display information about all the mounted filesystems disk space usage, which includes total space, used space, available space, memory utilization, and the percentage of space used for each filesystem.
If no filesystem is specified, df reports on all currently mounted filesystems.
Note: The Available column is not simply “Total minus Used.” Linux reserves a portion of each filesystem (typically 5%) for the root user to prevent system crashes when disk space runs low. This is why Used + Available often doesn’t equal the total size.
The ‘df‘ command stands for “disk filesystem“, it is used to get a full summary of available and used disk space usage of the file system on the Linux system.
On the internet, you will find plenty of tools for checking disk space usage in Linux. However, Linux has a strong built-in utility called ‘df‘.
Filesystem 1G-blocks Used Available Use% Mounted on
tmpfs 4G 1G 4G 1% /run
/dev/sda1 696G 321G 339G 49% /
tmpfs 16G 1G 15G 6% /dev/shm
tmpfs 1G 1G 1G 1% /run/lock
efivarfs 1G 1G 1G 20% /sys/firmware/efi/efivars
tmpfs 16G 0G 16G 0% /run/qemu
/dev/sda2 1G 1G 1G 3% /boot/efi
tmpfs 4G 1G 4G 1% /run/user/1000
/dev/sdb3 274G 3G 258G 2% /media/ravi/Personal_Sites
/dev/sdb1 229G 211G 6G 98% /media/ravi/Personal_Data
/dev/sdb2 458G 74G 361G 17% /media/ravi/Linux_VM

Inodes are what Linux uses to track files and directories – not file contents, but the metadata (permissions, ownership, timestamps, pointers to data blocks). A filesystem can run out of inodes while still having plenty of disk space, which will cause No space left on device errors even though df -h shows free space available.
df -x tmpfs -h

df -h

Using ‘-h‘ parameter with (df -h) will show the file system disk space statistics in “human-readable” format, which means it gives the details in bytes, megabytes, and gigabytes.
Filesystem Inodes IUsed IFree IUse% Mounted on
tmpfs 4.0M 1.3K 4.0M 1% /run
/dev/sda1 45M 1.6M 43M 4% /
tmpfs 4.0M 2.2K 4.0M 1% /dev/shm
tmpfs 4.0M 8 4.0M 1% /run/lock
efivarfs 0 0 0 – /sys/firmware/efi/efivars
tmpfs 4.0M 1 4.0M 1% /run/qemu
/dev/sda2 0 0 0 – /boot/efi
tmpfs 801K 152 801K 1% /run/user/1000
/dev/sdb3 18M 9.5K 18M 1% /media/ravi/Personal_Sites
/dev/sdb1 15M 21K 15M 1% /media/ravi/Personal_Data
/dev/sdb2 30M 2.2K 30M 1% /media/ravi/Linux_VM

df -h | sort -k5 -rn

sudo df -k

Disk Space Usage in Kilobytes
Disk Space Usage in Kilobytes

7. Check Disk Space Usage in Megabytes

Every 5.0s: df -h tecmint: Tue Mar 31 12:04:11 2026

Filesystem Size Used Avail Use% Mounted on
tmpfs 3.2G 2.9M 3.2G 1% /run
/dev/sda1 696G 321G 339G 49% /
tmpfs 16G 872M 15G 6% /dev/shm
tmpfs 5.0M 12K 5.0M 1% /run/lock
efivarfs 256K 49K 203K 20% /sys/firmware/efi/efivars
tmpfs 16G 0 16G 0% /run/qemu
/dev/sda2 286M 6.2M 280M 3% /boot/efi
tmpfs 3.2G 164K 3.2G 1% /run/user/1000
/dev/sdb3 274G 2.9G 258G 2% /media/ravi/Personal_Sites
/dev/sdb1 229G 211G 6.0G 98% /media/ravi/Personal_Data
/dev/sdb2 458G 74G 361G 17% /media/ravi/Linux_VM

14. Sort df Output by Usage Percentage

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 696G 321G 339G 49% /
/dev/sdb3 274G 2.9G 258G 2% /media/ravi/Personal_Sites
/dev/sdb1 229G 211G 6.0G 98% /media/ravi/Personal_Data
/dev/sdb2 458G 74G 361G 17% /media/ravi/Linux_VM

alias dfs=’df -h | sort -k5 -rn’

15. Check df Command Options

This script checks all mounted filesystems and sends an alert email when any partition crosses 85% usage.
Filesystem Type Size Used Avail Use% Mounted on
tmpfs tmpfs 3.2G 2.6M 3.2G 1% /run
/dev/sda1 ext4 696G 321G 339G 49% /
tmpfs tmpfs 16G 869M 15G 6% /dev/shm
tmpfs tmpfs 5.0M 12K 5.0M 1% /run/lock
efivarfs efivarfs 256K 49K 203K 20% /sys/firmware/efi/efivars
tmpfs tmpfs 16G 0 16G 0% /run/qemu
/dev/sda2 vfat 286M 6.2M 280M 3% /boot/efi
tmpfs tmpfs 3.2G 160K 3.2G 1% /run/user/1000
/dev/sdb3 ext4 274G 2.9G 258G 2% /media/ravi/Personal_Sites
/dev/sdb1 ext4 229G 211G 6.0G 98% /media/ravi/Personal_Data
/dev/sdb2 ext4 458G 74G 361G 17% /media/ravi/Linux_VM

5. Check Disk Space for a Specific Directory or Partition

You’ll typically use this when debugging container environments, chroot setups, or systemd mount unit issues where a pseudo-filesystem mount isn’t behaving as expected.
The -h flag converts bytes into KB, MB, GB, or TB automatically – whichever unit makes the most sense for the size involved.
sudo df -m

Disk Space Usage in Megabytes
Disk Space Usage in Megabytes

8. Check Disk Space Usage in Gigabyte

/dev/sdb1 229G 211G 6.0G 98% /media/ravi/Personal_Data
/dev/sda1 696G 321G 339G 49% /
efivarfs 256K 49K 203K 20% /sys/firmware/efi/efivars
/dev/sdb2 458G 74G 361G 17% /media/ravi/Linux_VM
tmpfs 16G 862M 15G 6% /dev/shm
/dev/sda2 286M 6.2M 280M 3% /boot/efi
/dev/sdb3 274G 2.9G 258G 2% /media/ravi/Personal_Sites
tmpfs 5.0M 12K 5.0M 1% /run/lock
tmpfs 3.2G 2.9M 3.2G 1% /run
tmpfs 3.2G 164K 3.2G 1% /run/user/1000
tmpfs 16G 0 16G 0% /run/qemu
Filesystem Size Used Avail Use% Mounted on

df -hT /home

Check /home Directory Disk Space
Check /home Directory Disk Space

watch -n 5 df -h

Filesystem Type Size Used Avail Use% Mounted on
tmpfs tmpfs 3.2G 2.9M 3.2G 1% /run
/dev/sda1 ext4 696G 321G 339G 49% /
tmpfs tmpfs 16G 859M 15G 6% /dev/shm
tmpfs tmpfs 5.0M 12K 5.0M 1% /run/lock
efivarfs efivarfs 256K 49K 203K 20% /sys/firmware/efi/efivars
tmpfs tmpfs 16G 0 16G 0% /run/qemu
/dev/sda2 vfat 286M 6.2M 280M 3% /boot/efi
tmpfs tmpfs 3.2G 164K 3.2G 1% /run/user/1000
/dev/sdb3 ext4 274G 2.9G 258G 2% /media/ravi/Personal_Sites
/dev/sdb1 ext4 229G 211G 6.0G 98% /media/ravi/Personal_Data
/dev/sdb2 ext4 458G 74G 361G 17% /media/ravi/Linux_VM

13. Monitor Disk Space in Real Time

This shows disk usage only for ext4 filesystems, which is useful on systems with a mix of filesystem types when you want to focus on just one kind.

Scenario 2: Application throwing “No space left on device” but df shows free space

df -Th

When you run df, it reports six columns for each mounted filesystem:

Scenario 3: Monitoring disk usage in a cron job

The df command is straightforward, but most guides stop at the basic flags. In practice, knowing how to combine options, interpret edge cases like inode exhaustion, and automate alerts is what separates reactive disk management from proactive server administration.
df –help

df -a

Show Information of Disk Space Usage
Show Information on Disk Space Usage

4. Show Filesystem Type Alongside Disk Usage

Usage: df [OPTION]… [FILE]…
Show information about the file system on which each FILE resides,
or all file systems by default.

Mandatory arguments to long options are mandatory for short options too.
-a, –all include pseudo, duplicate, inaccessible file systems
-B, –block-size=SIZE scale sizes by SIZE before printing them; e.g.,
‘-BM’ prints sizes in units of 1,048,576 bytes;
see SIZE format below
-h, –human-readable print sizes in powers of 1024 (e.g., 1023M)
-H, –si print sizes in powers of 1000 (e.g., 1.1G)
-i, –inodes list inode information instead of block usage
-k like –block-size=1K
-l, –local limit listing to local file systems

Reading df Output: Practical Scenarios

You might also like:
df [OPTIONS] [FILESYSTEM]

1. Check Overall Disk Space Usage

#!/bin/bash
THRESHOLD=85
df -h –output=pcent,target | tail -n +2 | while read PCT MNT; do
NUM=${PCT%%%}
if [ “$NUM” -ge “$THRESHOLD” ]; then
echo “WARNING: $MNT is at $PCT” | mail -s “Disk Alert: $MNT” [email protected]
fi
done

df vs du – Which One Should You Use?

A common point of confusion:

Similar Posts