Computer Science Atlas
Step-By-Step

Ubuntu: Check Disk Space Usage

January 28, 2021|Updated January 31, 2021
 
Table of Contents

Overview

This tutorial explains how to show total disk space usage by an entire disk volume (also called a file system). This means that if two directories (for example, /var/log/nginx/ and /home/ubuntu/ are on the same disk volume, the output for the command described below will be the same).

To find out how much disk space a specific directory is using (the total size of all files and subdirectories in the directory), see this tutorial.

Step 1. Open a Terminal Session

If you're using an Ubuntu laptop or desktop, you can press Ctrl + Alt + T on your keyboard to open a new terminal window. If you're using a remote Ubuntu server, you can connect using SSH to open a new terminal session.

Step 2. Use the df Command

Root Volume

To check disk space usage for the root volume mounted at /:

df -h /
$ df -h /

The -h option tells the command to show "human friendly" output (using familiar units like Gi for Gibibytes/Gigabytes and Mi for Mebibytes/Megabytes).

The / tells df to show disk usage for the volume where / is located.

You should see output like:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        59G  8.6G   50G  15% /

All Volumes

To show usage for all disk volumes on your system, you can leave out the / path:

df -h
$ df -h

Multiple Specific Volumes

To show usage for disks for specific paths, just add them to the end of the command. For example:

df -h / /run
$ df -h / /run

which should output:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root        59G  8.6G   50G  15% /
tmpfs           199M  4.2M  195M   3% /run