Innovate | Connect | Transform
ContactService statusUSD $

GICT knowledge base

Understanding Disk Space Usage in Ubuntu

Published

Linux and Commands

Introduction

Your Ubuntu computer stores many different types of files that can take up disk space over time. These include downloaded software, system logs, temporary files, and your personal data. Understanding where your storage space goes helps you keep your system running smoothly. This article shows you how to check what’s using space on your Ubuntu system and identify areas where you can free up storage. You will learn simple commands to analyze your disk usage and understand which files and folders are taking up the most space.

Prerequisites

Before following this article, ensure you have:

  • An Ubuntu machine (any version)
  • Basic knowledge of using the terminal
  • Administrative privileges (ability to use sudo)

Check Your Overall Disk Usage

Start by seeing how much space you’re currently using and how much you have available.

  • Open the terminal by pressing Ctrl + Alt + T.
  • Check your disk usage:
    $ df -h
    This shows all your storage drives and how full they are. Look for the row that shows / – this is your main system drive.
  • See which folders use the most space:
    $ sudo du -sh /* 2>/dev/null | sort -hr | head -10 

This lists the 10 largest folders on your system, helping you see where most of your space is being used.

Check What’s Using Space in Important Folders

Ubuntu stores different types of files in specific folders. Let’s check the main ones that often use lots of space.

Check System Files

Look at system folders:

$ sudo du -sh /var /usr /home /opt /tmp 
  • /var – Contains logs, caches, and system data
  • /usr – Contains installed programs
  • /home – Contains your personal files
  • /opt – Contains some installed software
  • /tmp – Contains temporary files

Check Downloaded Software Packages

Ubuntu saves copies of software you’ve installed. These can take up several gigabytes.

Check how much space downloaded packages use:

$ sudo du -sh /var/cache/apt/archives/ 

If you use Snap packages, check their space usage:

$ sudo du -sh /var/lib/snapd/ 

See how many Snap versions you have:

$ snap list --all | grep disabled | wc -l 

Ubuntu keeps old versions of Snap packages as backups, which can use extra space.

Check System Logs

Ubuntu keeps logs of system activity, but these can grow large over time.

Check log file usage:

$ sudo du -sh /var/log/ 

See which log files are largest:

$ sudo du -sh /var/log/* | sort -hr | head -5 

Check journal logs (Ubuntu’s main logging system):

$ sudo journalctl --disk-usage 

Check Your Personal Files

See how much space your home folder uses:

$ du -sh $HOME 

Check your Downloads folder:

$ du -sh ~/Downloads 

Look at hidden folders in your home directory:

$ du -sh ~/.[!.]* 2>/dev/null | sort -hr | head -5 

Hidden folders start with a dot (.) and often contain application data and caches.

Find Large Files Taking Up Space

Sometimes individual files can use lots of space. Here’s how to find them.

Find the largest files on your system:

$ sudo find / -type f -size +100M 2>/dev/null | head -10 

This finds files larger than 100 MB. The 2>/dev/null part hides error messages.

Find large files in your home folder:

$ find $HOME -type f -size +50M 2>/dev/null 

This finds files in your personal folder that are larger than 50 MB.

Use a Visual Tool to See Disk Usage

Ubuntu includes a graphical tool that makes it easy to see what’s using space.

Install the Disk Usage Analyzer:

$ sudo apt update
$ sudo apt install baobab 

Open it from the applications menu by searching for “Disk Usage Analyzer” or run:

$ baobab 

This tool shows a visual map of your disk usage, making it easy to spot large files and folders.

Check for Common Space Users

Here are some common things that use lots of space and how to check them:

Browser Cache

Check Firefox cache:

$ du -sh ~/.cache/mozilla/ 

Check Chrome cache:

$ du -sh ~/.cache/google-chrome/ 

Application Caches

Check all application caches:

$ du -sh ~/.cache/ 

Trash Folder

Check your trash folder:

$ du -sh ~/.local/share/Trash/ 

Create a Simple Storage Report

You can easily create a summary of your storage usage:

Create a simple report:

$ echo "=== My Ubuntu Storage Report ==="
$ echo "Date: $(date)"
$ echo ""
$ echo "Overall disk usage:"
$ df -h /
$ echo ""
$ echo "Largest folders:"
$ sudo du -sh /* 2>/dev/null | sort -hr | head -5
$ echo ""
$ echo "Package cache size:"
$ sudo du -sh /var/cache/apt/archives/
$ echo ""
$ echo "Home folder size:"
$ du -sh $HOME 

Copy and paste these commands one by one to get a quick overview of your system.

Understanding Your Results

Here’s what the numbers mean and when you should take action:

Disk Usage Percentages

  • 0-70%: Your system has plenty of space
  • 70-85%: Keep an eye on usage and do regular cleanup
  • 85-95%: You should clean up files soon
  • 95-100%: Clean up immediately – your system may slow down

Common File Sizes

  • KB (Kilobytes): Very small files, usually not a concern
  • MB (Megabytes): Medium files like photos or documents
  • GB (Gigabytes): Large files like videos, or collections of many files
  • TB (Terabytes): Very large amounts of data

Simple Maintenance Tips

To keep your system healthy:

  • Check disk usage monthly: Run df -h to see your usage percentage
  • Empty your trash regularly: Right-click the trash icon and select “Empty Trash”
  • Clean your Downloads folder: Delete files you no longer need
  • Clear browser cache: Use your browser’s settings to clear cache and temporary files
  • Remove unused software: Use Software Center or sudo apt remove package-name to uninstall programs you don’t use

Conclusion

Understanding where your disk space goes helps you maintain a healthy Ubuntu system. You learned how to check overall disk usage, identify large files and folders, and recognize common space consumers like package caches and logs.

Regular monitoring prevents storage problems before they affect your system’s performance. Use the simple commands provided to check your disk usage monthly and keep track of what’s taking up space. The visual tools like Disk Usage Analyzer make it easy to spot storage issues quickly.

Remember that keeping 15-30% of your disk space free ensures optimal system performance and leaves room for temporary files and system updates.

Related guides

Account services are unavailable until the production backend is configured.