Running out of storage space on a Linux server can cause catastrophic errors. Databases will fail to write, applications will crash, and in severe cases, the operating system may refuse to boot entirely.
Whether you are managing a headless web server over SSH or using a personal Ubuntu laptop, monitoring your available storage is a critical administrative task. Here is how to check disk space in Ubuntu using both the command line and the graphical interface.
Method 1: The “df” Command (Terminal Method)
The df (disk free) command is the gold standard for checking storage across the entire Linux ecosystem. It is incredibly fast and works on every single Linux distribution in existence.
- Open your terminal (press Ctrl + Alt + T on a desktop, or connect via SSH).
- Type the following command:
df -h - Press Enter.
What the -h flag does: By default, the df command outputs storage capacity in raw bytes, which is very difficult to read. Adding the -h (human-readable) flag forces the system to translate those numbers into Megabytes (MB), Gigabytes (GB), and Terabytes (TB).
You will see a table listing all mounted filesystems. Look for the line where the “Mounted on” column says / (the root directory). The “Use%” column will tell you exactly how full your main hard drive is.
Method 2: The “du” Command (Finding Large Files)
If the df command tells you that your drive is 99% full, your next step is to figure out what is taking up all that space. That is where the du (disk usage) command comes in.
- Navigate to the folder you want to inspect (e.g.,
cd /var/log). - Type the following command:
sudo du -sh * - Press Enter.
This command will scan every single file and folder inside your current directory and print out a clean list showing exactly how much space each item is consuming. (The -s flag summarizes the totals so you do not get thousands of lines of output, and -h makes it human-readable).
Method 3: The Disk Usage Analyzer (GUI Method)
If you are using the standard Ubuntu GNOME desktop and prefer not to memorize terminal commands, Ubuntu includes a beautiful visual tool for managing storage.
- Click the Show Applications grid icon in your dock (or press the Windows/Super key).
- Type Disk Usage Analyzer into the search bar.
- Click the application icon to open it (it looks like a pie chart).
- Click on your main hard drive (usually labeled “Computer” or with its total gigabyte capacity).
The application will scan your entire hard drive and generate a color-coded ring chart. You can easily click into the largest red slices of the pie to navigate deep into your folder structure and find the exact movies, backups, or log files that are wasting your space.