How to Check Disk Space in Linux Using df

If a Linux server suddenly stops accepting database entries or refuses to download a system update, the most common culprit is a completely full hard drive. When a partition reaches 100% capacity, the operating system can no longer write temporary files, and critical services will crash without warning. In a graphical environment, you simply open “My Computer” to see a pie chart of your storage space. In the Linux terminal, you must rely on the df command to check your disk utilization and identify which drive is causing the bottleneck.

The Basic Command and the “Human Readable” Flag

The acronym df stands for Disk Filesystem (though many administrators remember it as “Disk Free”).

If you type df and press Enter, Linux will output a confusing table filled with massive numbers representing raw 1-kilobyte blocks. This is practically useless for a quick diagnosis.

You should always pair df with the -h flag. This stands for “human-readable,” and it forces Linux to automatically translate those massive numbers into Megabytes (M) and Gigabytes (G).

  • The Command: df -h

How to Read the Output Table

When you run df -h, the terminal will print a table containing all your connected drives, USB sticks, and system partitions. You need to focus on four critical columns:

  1. Filesystem: The physical name of the hard drive (e.g., /dev/sda1 or /dev/nvme0n1p2).
  2. Size: The total storage capacity of that drive.
  3. Avail: The actual amount of free space remaining.
  4. Use%: The most important column. It shows a simple percentage (e.g., 85%). If any drive is at 99% or 100%, you have found your crisis.
  5. Mounted on: This tells you what folder that drive represents. The most important one is the root partition, indicated by a single forward slash (/). If / is full, your entire server will crash.

Filtering for Local Hard Drives Only

Modern Linux systems use dozens of “virtual” filesystems (like tmpfs or snap loops) that clutter the df output. If you are running Ubuntu with Snap packages installed, running df -h might output 40 lines of junk data, hiding your actual physical hard drive.

To tell the command to ignore the virtual junk and only show real, physical hard drives, use the lower-case -x flag to exclude specific filesystem types.

  • The Command: df -h -x tmpfs -x squashfs

This will strip away the temporary RAM disks and Snap loops, leaving you with a clean, easy-to-read table showing only your actual physical storage.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.