How to Check Available Disk Space in Linux

Monitoring your storage is a crucial part of managing any Linux system. Whether you are running a personal desktop, managing a home lab server, or administrating enterprise cloud instances, knowing how much storage is available prevents unexpected crashes and application failures. In Linux, checking disk space is fast and efficient using built-in command-line tools.

Why Monitoring Disk Space Matters

When a Linux partition reaches 100% capacity, the system can behave unpredictably. Applications may fail to start, logs cannot be written, and in severe cases, the operating system might refuse to boot entirely. Regularly checking your available disk space helps you proactively identify large log files, unnecessary backups, or growing databases before they cause a critical outage.

Using the df Command (Disk Free)

The standard tool for checking disk space in Linux is the df command. It provides a complete overview of all mounted filesystems, their total capacity, and how much space is currently in use.

Step-by-Step Instructions

  1. Open your terminal application (or connect to your server via SSH).
  2. Type the command df -h and press Enter.
  3. The terminal will output a list of your filesystems.

Understanding the Output

The -h flag is essential—it stands for “human-readable.” Without it, df displays sizes in raw 1K blocks, which are difficult to interpret. With the -h flag, the sizes are displayed in Megabytes (M), Gigabytes (G), or Terabytes (T).

In the output, you will see several columns:

  • Filesystem: The name of the storage device or partition (e.g., /dev/sda1).
  • Size: The total storage capacity of the partition.
  • Used: The amount of space currently occupied.
  • Avail: The remaining free space.
  • Use%: The percentage of space used. Pay close attention to any partition approaching 90% or higher.
  • Mounted on: The directory where the filesystem is attached to the operating system (e.g., / for the root filesystem, or /home).

Advanced Usage: Checking Specific Directories with du

While df shows you partition-level disk space, it does not tell you which files or folders are consuming that space. For that, you need the du (Disk Usage) command.

If you notice a partition is almost full, navigate to it and run:

du -sh *

This command summarises the size of every file and folder in the current directory, helping you pinpoint exactly what is consuming your storage.

Troubleshooting Common Issues

If you are encountering problems when checking disk space, consider these common scenarios:

  • Permission denied: Some system directories cannot be read by standard users. If you run du and receive permission errors, prepend the command with sudo (e.g., sudo du -sh *) to run it with administrative privileges.
  • df shows free space, but writing fails: If df -h shows plenty of available gigabytes but you cannot save files, you might have run out of inodes (the index structures that store file metadata). This often happens if you have millions of tiny files. Run df -i to check your inode usage. If it is at 100%, you will need to delete files even if you have physical disk space remaining.

By combining df for a high-level overview and du for detailed investigation, you can effectively manage storage across any Linux environment.

Get the best tech tips delivered straight to your inbox.

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