How to Check Disk Space in Linux

Unlike Windows, which provides a highly visual pie chart indicating how much of your C: drive is full, a headless Linux server requires you to query the operating system directly to determine your remaining disk capacity. Allowing a Linux server to reach 100% disk usage is catastrophic; databases will corrupt, log files will fail to write, and you may even find yourself completely locked out of SSH access.

To prevent this, you must routinely monitor your disk partitions. The absolute fastest and most reliable way to do this is by using the df (Disk Free) command in the terminal.

Method 1: The “df” Command (The Human-Readable Overview)

If you only need a rapid, top-level overview of how much space is left on your primary hard drive, this is the only command you need to memorize.

  1. Open your terminal or SSH into your server.
  2. Type this command exactly:

df -h

  1. Press Enter.

By itself, the df command outputs data in raw 1K blocks (which is completely unreadable to humans). Adding the -h flag commands the system to format the output into “Human-readable” Megabytes (M), Gigabytes (G), and Terabytes (T).

The terminal will print a clean table. Look for the row that has a / (a single forward slash) in the far-right “Mounted on” column. This represents your root partition (your main C: drive, in Windows terms).

Look across that row to see:

  • Size: The total physical capacity of the drive.
  • Used: How much space is currently occupied.
  • Avail: The exact amount of free space remaining.
  • Use%: A percentage indicating how full the drive is. (If this hits 95%, you must act immediately).

Method 2: Target a Specific Hard Drive

If you have a complex server architecture with multiple block storage volumes attached (e.g., an AWS EC2 instance with three different EBS volumes mounted), the standard df -h output can be overwhelming, listing dozens of virtual, temporary file systems.

You can tell the df command to inspect one specific drive path, ignoring everything else.

df -h /mnt/database_backup_drive

The terminal will return a single row of data exclusively for that specific mounted hard drive, making it much easier to read inside automated monitoring scripts.

Method 3: Include File System Types

If you are diagnosing a highly technical issue, you might need to know not only how much space is left, but also what specific filesystem architecture (like ext4, xfs, or btrfs) the drive was formatted with.

You can add the -T flag to inject this information into the output table.

df -Th

A new column labeled “Type” will appear, instantly identifying the underlying architecture of every mounted drive on your server.

What if the Drive is 100% Full?

If you run df -h and discover that your root drive (/) is at 100% capacity, you have a massive problem. The df command tells you that the drive is full, but it cannot tell you what is filling it up.

To find the bloated files and delete them, you must switch from the df (Disk Free) command to the du (Disk Usage) command.

Type this command to scan the root of your server and list the 15 heaviest folders:

sudo du -h -d 1 / | sort -hr | head -n 15

This will point you directly to the offending directory (often /var/log or /var/lib/mysql) so you can begin deleting old data and restoring functionality to the server.

Get the best tech tips delivered straight to your inbox.

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