How to Use the df Command to Instantly Check Total Free Hard Drive Space in Linux

When you are managing a headless Linux server via the terminal, there is no graphical “My Computer” icon to click on to see how much hard drive space is left. If you are about to download a massive 50GB database backup, you cannot guess if the drive can hold it. If the drive hits 100% capacity, the server will violently crash. To instantly check the exact amount of total free space remaining on all connected drives, you must use the df (Disk Free) command.

What Does the df Command Do?

The standard ls command only tells you how large individual files are. The df command operates at the hardware level. It queries the actual filesystem partitions and outputs a comprehensive mathematical report detailing exactly how massive the hard drive is, how much space is currently occupied, and how much space is mathematically remaining.

How to Check Your Storage Space

If you type the command raw, the output is nearly impossible to read.

  1. Open your Linux terminal.
  2. Type the raw command: df
  3. Press Enter.

The terminal will output the data in raw “1-Kilobyte blocks,” resulting in massive, confusing strings of numbers like 102938475. To make this data readable by a human, you must use a highly specific flag.

Using the Human-Readable Flag

  1. In the terminal, type the following upgraded command:

df -h

  1. Press Enter.

The -h flag stands for “human-readable.” The terminal will instantly convert the massive numbers into beautiful, easily recognizable Gigabytes (G), Megabytes (M), and Terabytes (T).

Understanding the Output

Look at the terminal output. You will see several columns.

  • Filesystem: The technical name of the drive partition (e.g., /dev/sda1).
  • Size: The absolute maximum capacity of the drive (e.g., 500G).
  • Used: The amount of space currently filled with data.
  • Avail: The exact amount of free space remaining. This is the most critical column.
  • Use%: A clean percentage indicating how close you are to a catastrophic crash (e.g., 85%).
  • Mounted on: The directory where the drive is attached. Look for the root symbol (/) to see your primary operating system drive.

Get the best tech tips delivered straight to your inbox.

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