df Command in Linux: Check Disk Space Usage

By 

Updated on

10 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.7M  7.9G   1% /run
/dev/nvme0n1p3  212G  175G   27G  87% /
tmpfs           7.9G  147M  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   40K  1.6G   1% /run/user/1000

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

Block Size Options

The -h option is convenient at the terminal, but capacity reports and scripts usually need a fixed unit. The -k option forces 1K blocks, which is also the default on most systems:

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

To pick a different unit, use -B (--block-size) followed by a size letter. The following command reports sizes in gibibytes:

Terminal
df -BG /
output
Filesystem     1G-blocks  Used Available Use% Mounted on
/dev/nvme0n1p3      212G  175G       27G  87% /

A bare size letter such as G appends the unit to every value. Writing the size with a leading number, as in -B1G, uses the same unit but prints plain numbers with no suffix. The same applies to -BM for mebibytes and -BT for tebibytes.

The -h option and bare -B suffixes such as -BG, -BM, and -BT use powers of 1024. Add B to the suffix to select a decimal unit, such as -BGB for 1,000,000,000-byte blocks. Disk manufacturers advertise capacity in powers of 1000, which is why a drive sold as 240 GB shows up as a smaller number with df -h. The -H (--si) option switches to that convention:

Terminal
df -H /
output
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p3  228G  188G   29G  87% /

Nothing about the partition changed. Only the divisor did, so the same filesystem reads as 212G with -h and 228G with -H.

One flag that does not exist here is -m. It belongs to the BSD version of df that ships with macOS, and GNU df on Linux rejects it. Use -BM when you want mebibyte-sized blocks.

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.7M  7.9G   1% /run
/dev/nvme0n1p3 ext4      212G  175G   27G  87% /
tmpfs          tmpfs     7.9G  147M  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  175G   27G  87% /
/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  175G   27G  87% /
/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.

Filtering works in the other direction too. By default df hides pseudo filesystems that have no storage of their own, and the -a (--all) option brings them back:

Terminal
df -h -a

On servers with network mounts, the -l (--local) option restricts the output to local filesystems and skips NFS or CIFS shares. This also keeps df from hanging when a remote server stops responding:

Terminal
df -h -l

Display Total Disk Space

The --total option appends a row at the bottom that sums all the filesystems shown. Combine it with -t to total only the partitions you care about:

Terminal
df -h --total -t ext4
output
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p3  212G  175G   27G  87% /
/dev/sda1       459G  165G  271G  38% /data
total           671G  340G  297G  54% -

The total row carries a dash instead of a mount point because it does not belong to any single filesystem. Notice that 340G used plus 297G available comes to less than the 671G total. The gap is the space these ext4 filesystems reserve for privileged processes, which df counts toward the size but not toward what is available to regular users.

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. Our guide on what an inode is covers how to track down the directories consuming them.

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  175G   27G  87%
/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
87%

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 in powers of 1024
df -HHuman-readable sizes in powers of 1000
df -kSizes in 1K blocks
df -BGSizes in 1G blocks
df -TShow filesystem types
df -t ext4Show only ext4 filesystems
df -x tmpfsExclude tmpfs filesystems
df -aInclude pseudo filesystems
df -h -lShow local filesystems only
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: invalid option – ’m’
GNU df has no -m option, even though the BSD version on macOS does. Use -BM to report sizes in 1 MiB blocks.

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?
Ext2, ext3, and ext4 filesystems reserve blocks for privileged processes, typically 5% by default. This reserved space is not counted as “available” for regular users. The tune2fs -m option changes the reserved percentage on those filesystems.

Why does df -h report a smaller disk than the one I bought?
df -h divides by 1024, while drive manufacturers advertise capacity in powers of 1000. Run df -H to see the size in the same units the vendor used.

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