How to Check Disk Space in Linux: Commands, Tools, and What the Output Means

Running out of disk space on a Linux system can cause everything from failed software installs to a completely unresponsive server. Knowing how to check disk space — and how to read what you're looking at — is one of the most practical skills for anyone working with Linux, whether you're managing a home desktop or a production server.

The Core Command: df

The df command (disk free) is the standard tool for checking disk space in Linux. Run it in a terminal like this:

df -h 

The -h flag stands for human-readable, which converts raw byte counts into MB and GB. Without it, output is shown in 512-byte blocks — technically accurate, but harder to parse at a glance.

A typical df -h output looks like:

Filesystem Size Used Avail Use% Mounted on /dev/sda1 50G 18G 30G 38% / tmpfs 2.0G 0 2.0G 0% /dev/shm /dev/sdb1 200G 145G 55G 73% /home 

What Each Column Means

ColumnMeaning
FilesystemThe storage device or partition
SizeTotal capacity of that partition
UsedSpace currently occupied
AvailSpace remaining for use
Use%Percentage of space consumed
Mounted onWhere in the directory tree that partition lives

One important note: Use% can reach 100% before Used equals Size. Linux reserves a small percentage of space (typically around 5%) for the root user and system processes, so regular users may hit limits before the partition is technically full.

Checking a Specific Directory: du

df tells you about partitions. The du command (disk usage) tells you how much space a specific directory or file is consuming:

du -sh /home/username 
  • -s gives a summary (total for the directory, not every subdirectory)
  • -h keeps output human-readable

To see which subdirectories are the biggest offenders:

du -h --max-depth=1 /home/username 

This is especially useful when df shows a partition filling up and you need to find where the space is actually going. 🔍

Checking Inode Usage

A less obvious cause of "disk full" errors is inode exhaustion. Every file on a Linux filesystem uses an inode — a data structure that stores file metadata. A partition can run out of inodes before it runs out of raw storage space, which causes the same errors as a full disk.

Check inode usage with:

df -i 

The output mirrors the standard df format but shows inode counts instead of storage capacity. If IUse% is near 100% on a partition, you'll hit write errors even if gigabytes of space remain. This tends to happen on systems that generate enormous numbers of small files — mail servers, cache-heavy applications, and certain development environments.

Graphical Tools for Desktop Linux Users 🖥️

Command-line tools aren't the only option. Most major Linux desktop environments include a graphical disk usage utility:

  • GNOME Disks (gnome-disks) — shows partition layout, size, and health status
  • Baobab (GNOME Disk Usage Analyzer) — visual treemap of which directories consume the most space
  • KDE Partition Manager — detailed partition view for KDE/Plasma users
  • Filelight — KDE's radial disk usage visualizer, similar to Baobab

These tools are better suited to visual exploration than scripting or automation, but they can make it much faster to identify space hogs on a desktop system.

Third-Party CLI Tools Worth Knowing

Two popular command-line alternatives go beyond what du offers by combining speed with interactivity:

  • ncdu — an ncurses-based disk usage browser. Install it, point it at a directory, and navigate a live, sortable list of what's consuming space. Much faster than reading du output for large directories.
  • duf — a modern replacement for df with color-coded output and a cleaner layout. Not installed by default on most distributions but widely available in package managers.

Neither replaces the built-in tools, but they can significantly speed up the process of diagnosing space issues on a system you're not familiar with.

Factors That Change What You See

The output of these commands isn't always straightforward to interpret, and several variables affect what you're looking at:

Filesystem type matters. df behaves consistently across most common filesystems (ext4, XFS, Btrfs), but Btrfs in particular can show available space differently due to its handling of snapshots and data allocation. A Btrfs partition may show more free space than is practically usable.

Mounted network storage (NFS, CIFS/Samba shares) will appear in df output alongside local drives. This is useful, but a slow or disconnected network mount can cause df to hang.

Bind mounts and overlay filesystems — common in Docker environments — can make df output harder to read. A container's filesystem may appear as a separate entry, and the relationship between it and the underlying storage isn't always obvious from df alone.

Snap packages (on Ubuntu and related distributions) create multiple loop-mounted filesystems that show up in df output. This is normal, but it can make the output feel cluttered. Adding --exclude-type=squashfs filters them out:

df -h --exclude-type=squashfs 

Automating Disk Space Monitoring

For servers and systems that need regular monitoring, checking manually isn't sustainable. A simple bash script combined with cron can send an alert when usage crosses a threshold — typically 80% or 90% is used as the warning point. More comprehensive solutions like Nagios, Zabbix, Prometheus with Node Exporter, and Netdata all include disk space monitoring out of the box.

Whether manual checks are enough or automated monitoring is necessary depends entirely on what the system is running, how quickly storage typically fills, and how serious the consequences of running out of space would be. 🗂️

The commands are consistent across Linux distributions, but how you act on what they tell you — whether you clean up files, expand a partition, add storage, or set up alerts — depends on your specific setup, what the system is used for, and how it's configured.