How to View Overall Disk Usage in Ubuntu Linux Using the df Command

When operating a Linux server, running out of hard drive storage can cause catastrophic system failures, preventing databases from writing new records and stopping essential services from launching. Unlike a graphical desktop environment where you can simply click “My Computer” to view a visual pie chart of your hard drive space, navigating a headless Ubuntu server requires terminal commands. The most fundamental and crucial tool for monitoring your overall system storage is the df (disk free) command.

What Does the df Command Do?

The df command stands for “disk free.” When executed, it queries the file system and generates a comprehensive report detailing every mounted hard drive, partition, and virtual file system currently active on your Linux machine. It reports the total size of each drive, how much space is currently being consumed, how much space is absolutely free, and the percentage of the drive that is full.

How to Use the Basic df Command

To view your disk usage, simply open your terminal and type the command by itself:

df

Press Enter. You will immediately see a table of data. However, you will likely notice a significant problem: the numbers in the “1K-blocks,” “Used,” and “Available” columns are massive, confusing strings of digits. By default, the df command displays all storage data in raw 1-kilobyte blocks, which is incredibly difficult for a human to read quickly.

The Essential “-h” Flag (Human-Readable)

To make the output useful, you must almost always pair the df command with the -h flag. This stands for “human-readable.”

Type the following command:

df -h

When you execute this, the output transforms dramatically. Instead of thousands of kilobytes, the terminal will dynamically convert the sizes into Megabytes (M), Gigabytes (G), or Terabytes (T), making it instantly understandable at a glance.

Understanding the Output Columns

When you run df -h, you need to know how to interpret the resulting table:

  • Filesystem: The actual hardware name of the drive or partition (e.g., /dev/sda1 or /dev/nvme0n1p2). You can ignore “tmpfs” lines, as those are temporary virtual file systems stored in RAM, not physical hard drives.
  • Size: The total capacity of that specific partition.
  • Used: The amount of storage currently consumed by files.
  • Avail: The amount of completely free space remaining.
  • Use%: A quick visual percentage of how full the drive is. If your main drive is at 95%, you need to act quickly.
  • Mounted on: The directory where this drive is attached to your Linux system. The drive mounted at simply / is your primary “root” drive containing your operating system and user files.

How to Check a Specific Drive or Folder

If you have multiple hard drives and you only want to check the usage of the specific drive where a certain folder is located, you can append the directory path to the command.

For example, to check the disk space of the drive holding your user data, type:

df -h /home/

The terminal will filter the output and display only the statistics for the specific partition that houses the /home/ directory.

Get the best tech tips delivered straight to your inbox.

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