df Command in Linux: Check Disk Space Usage

By 

Updated on

8 min read

Linux df Command

When you need to investigate a disk-full alert, check available space before a deployment, or verify inode usage, the df command is usually the first tool to run.

The df command (short for disk free) reports how much disk space is used and available on mounted filesystems. It is one of the essential tools for monitoring storage on Linux systems.

This guide explains how to use the df command with practical examples covering all common options.

df Command Syntax

The general syntax for the df command is:

txt
df [OPTIONS] [FILESYSTEM...]

When used without any arguments, df displays information about all mounted filesystems :

Terminal
df
output
Filesystem     1K-blocks      Used Available Use% Mounted on
dev              8172848         0   8172848   0% /dev
run              8218640      1696   8216944   1% /run
/dev/nvme0n1p3 222284728 183057872  27865672  87% /
tmpfs            8218640    150256   8068384   2% /dev/shm
tmpfs            8218640         0   8218640   0% /sys/fs/cgroup
tmpfs            8218640        24   8218616   1% /tmp
/dev/nvme0n1p1    523248    107912    415336  21% /boot
/dev/sda1      480588496 172832632 283320260  38% /data
tmpfs            1643728        40   1643688   1% /run/user/1000

Each line includes the following columns:

  • Filesystem - The name of the filesystem.
  • 1K-blocks - The total size of the filesystem in 1K blocks.
  • Used - The used space in 1K blocks.
  • Available - The available space in 1K blocks.
  • Use% - The percentage of used space.
  • Mounted on - The directory on which the filesystem is mounted.

To display information for a specific filesystem, pass its name or mount point to the df command:

Terminal
df /
output
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/nvme0n1p3 222284728 183057872  27865672  87% /

Human-Readable Output

By default, df shows sizes in 1K blocks. To display sizes in a human-readable format (KB, MB, GB), use the -h option:

Terminal
df -h
output
Filesystem      Size  Used Avail Use% Mounted on
dev             7.8G     0  7.8G   0% /dev
run             7.9G  1.8M  7.9G   1% /run
/dev/nvme0n1p3  212G  176G   27G  88% /
tmpfs           7.9G  145M  7.7G   2% /dev/shm
tmpfs           7.9G     0  7.9G   0% /sys/fs/cgroup
tmpfs           7.9G   24K  7.9G   1% /tmp
/dev/nvme0n1p1  511M  106M  406M  21% /boot
/dev/sda1       459G  165G  271G  38% /data
tmpfs           1.6G   16K  1.6G   1% /run/user/1000

This is the most commonly used form of the df command.

Display Filesystem Types

The -T option adds a “Type” column showing the filesystem type of each partition:

Terminal
df -Th
output
Filesystem     Type      Size  Used Avail Use% Mounted on
dev            devtmpfs  7.8G     0  7.8G   0% /dev
run            tmpfs     7.9G  1.8M  7.9G   1% /run
/dev/nvme0n1p3 ext4      212G  176G   27G  88% /
tmpfs          tmpfs     7.9G  145M  7.7G   2% /dev/shm
/dev/nvme0n1p1 vfat      511M  106M  406M  21% /boot
/dev/sda1      ext4      459G  165G  271G  38% /data

Filter by Filesystem Type

To show only filesystems of a specific type, use the -t option followed by the type name. For example, to list only ext4 partitions:

Terminal
df -h -t ext4
output
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p3  212G  176G   27G  88% /
/dev/sda1       459G  165G  271G  38% /data

To exclude a specific filesystem type, use the -x option. The following command hides all tmpfs filesystems:

Terminal
df -h -x tmpfs
output
Filesystem      Size  Used Avail Use% Mounted on
dev             7.8G     0  7.8G   0% /dev
/dev/nvme0n1p3  212G  176G   27G  88% /
/dev/nvme0n1p1  511M  106M  406M  21% /boot
/dev/sda1       459G  165G  271G  38% /data

Excluding tmpfs is useful when you want to focus on physical disks and partitions.

Display Total Disk Space

The --total option appends a row at the bottom that sums all filesystems:

Terminal
df -h --total

The last line of the output shows the total size, used space, and available space across all mounted filesystems.

Display Inode Usage

An inode is a data structure in Linux filesystems that stores metadata about a file or directory, such as its size, owner, permissions, and timestamps. Each file uses one inode, and a filesystem has a fixed number of inodes.

To display inode usage instead of block usage, use the -i option:

Terminal
df -ih /
output
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/nvme0n1p3    14M  1.9M   12M   14% /

The output includes the following columns:

  • Inodes - The total number of inodes on the filesystem.
  • IUsed - The number of used inodes.
  • IFree - The number of free (unused) inodes.
  • IUse% - The percentage of used inodes.

Running out of inodes prevents creating new files even if disk space is available. This can happen on filesystems with many small files.

Custom Output Format

The --output option lets you select which columns to display. Specify a comma-separated list of field names:

Terminal
df -h -t ext4 --output=source,size,used,avail,pcent
output
Filesystem      Size  Used Avail Use%
/dev/nvme0n1p3  212G  176G   27G  88%
/dev/sda1       459G  165G  271G  38%

The available field names are:

  • source - The filesystem source.
  • fstype - The filesystem type.
  • file - The file name when a file argument is supplied.
  • size - Total disk space.
  • used - Used disk space.
  • avail - Available disk space.
  • pcent - Percentage of used space.
  • itotal - Total number of inodes.
  • iused - Number of used inodes.
  • iavail - Number of available inodes.
  • ipcent - Percentage of used inodes.
  • target - The mount point.

POSIX Output for Scripts

When parsing df output in a shell script, the default format can wrap long device names onto two lines, which breaks tools like awk. The -P (--portability) option forces one line per filesystem:

Terminal
df -P /
output
Filesystem     1024-blocks      Used Available Capacity Mounted on
/dev/nvme0n1p3   222284728 183057872  27865672      87% /

For example, to extract the used percentage for the root filesystem:

Terminal
df -P / | awk 'NR==2 {print $5}'
output
88%

Add --sync to force a filesystem sync before reading, which gives more accurate results immediately after large writes.

df vs du

df reports usage at the filesystem level by reading filesystem metadata. The du command walks a directory tree and sums the sizes of visible files.

The two often disagree. When df shows a disk as full but du reports less, a process is usually holding a deleted file open. Find those files with:

Terminal
sudo lsof +L1

Restart or stop the owning process to release the space.

Quick Reference

For a printable quick reference, see the df cheatsheet .

CommandDescription
dfShow all mounted filesystems
df /Show a specific filesystem
df -hHuman-readable sizes (KB, MB, GB)
df -TShow filesystem types
df -t ext4Show only ext4 filesystems
df -x tmpfsExclude tmpfs filesystems
df -h --totalShow total across all filesystems
df -iShow inode usage
df -ih /Inode usage in human-readable format
df --output=source,size,pcentCustom output columns
df -P /POSIX one-line output for scripts
df --sync -hForce sync before reading sizes

Troubleshooting

df: no file systems processed
This usually means the provided path is invalid or no longer mounted. Verify the path with ls and check active mounts with mount or findmnt.

df and du show different usage values
df reports filesystem-level usage, while du reports visible files in directories. The difference is often caused by deleted files that are still open or filesystem metadata usage.

Disk appears full but no large files are visible
A process may still hold a deleted file open. List deleted-but-open files with sudo lsof +L1, then restart or stop the relevant process to release the space.

Inodes are at 100 percent but space is still available
The filesystem has too many small files. Check with df -ih, then locate high file-count paths with find and clean or archive old files.

FAQ

What is the difference between df and du?
df reports free and used space on entire filesystems. The du command reports the disk space used by individual files and directories. Use df for an overview and du to find what is consuming space.

Why does df show less available space than expected?
Most Linux filesystems reserve a percentage of space (usually 5%) for the root user. This reserved space is not counted as “available” for regular users. You can adjust it with tune2fs -m.

Why does df show a disk is full but du shows less usage?
This can happen when deleted files are still held open by running processes. The space is not released until the process closes the file. Use sudo lsof +L1 to find deleted files that are still open.

What does it mean when inodes are full?
When a filesystem runs out of inodes, you cannot create new files even if disk space is available. This typically happens on filesystems with a large number of very small files. You can check inode usage with df -ih.

How do I check disk space on a remote server?
Connect via SSH and run df -h. You can also run it directly with ssh user@host df -h without opening an interactive session.

Conclusion

The df command is essential for monitoring disk space on Linux systems. Use df -h for a quick human-readable overview, -T to see filesystem types, -i to check inode usage, and --total for a combined summary. When filesystem totals do not match visible directory usage, compare the results with du and check for deleted files still held open by running processes.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page