How to Clean Disk Space on Ubuntu

Tech reviewed: Deepak Prasad
Ubuntu disk cleanup illustration with BleachBit, apt cache, and journal vacuum freeing storage space

A full root filesystem slows updates, breaks builds, and can freeze the desktop. On Ubuntu you do not need a single proprietary “disk cleaner” to fix that—apt, journalctl, user caches, old Snap revisions, and optional GUI tools such as BleachBit or Ubuntu Cleaner each target different clutter.

This guide covers practical Ubuntu cleaning: see what is using space, reclaim room with terminal commands you can script, install BleachBit from universe, add Ubuntu Cleaner from the gerardpuig PPA when you want a janitor-style app, and preview deletions before you commit. I ran these steps on Ubuntu 25.04 and kept the real output below. Where a tool surprised me—400 MB in apt archives, BleachBit deleting apt lists if you are not careful, Ubuntu Cleaner’s GUI-only interface—the notes sit in the same section.

Tested on: Ubuntu 25.04 (Plucky Puffin); kernel 6.14.0-37-generic.

IMPORTANT
Preview before bulk deletes. BleachBit and Ubuntu Cleaner can remove apt package lists, browser data, or caches your apps still need. On servers, prefer apt and journalctl over blind GUI “select all.”

Quick command summary

Task Command
Check disk use df -h and du -sh ~/.cache /var/cache/apt/archives
Visual disk map (GUI) baobab (Disk Usage Analyzer)
Clear downloaded debs sudo apt clean
Drop obsolete debs sudo apt autoclean
Remove unused deps sudo apt autoremove -y
Journal size journalctl --disk-usage
Trim journals sudo journalctl --vacuum-time=7d
Install BleachBit sudo apt install -y bleachbit
BleachBit preview bleachbit --preview apt.clean
Install Ubuntu Cleaner sudo add-apt-repository -y ppa:gerardpuig/ppa && sudo apt update && sudo apt install -y ubuntu-cleaner
Launch Ubuntu Cleaner ubuntu-cleaner

What usually fills the disk on Ubuntu

Location Typical contents Safe to trim?
/var/cache/apt/archives Downloaded .deb files Yes, with apt clean
/var/lib/apt/lists Package index files After apt clean only if you run apt update next
~/.cache App thumbnails, pip, browser fragments Often; apps rebuild caches
/var/log and journal journald archives Yes, with journalctl --vacuum-*
Old Snap revisions Disabled rows in snap list --all Yes, with snap remove name --revision=N
Trash ~/.local/share/Trash Yes, when you do not need deleted files

For a deeper pass on orphan packages, see remove unused packages on Ubuntu. For everyday apt maintenance, the three commands clean, autoclean, and autoremove cover most systems without extra software.


See what is using space first

Before you install a disk cleaner for Ubuntu, measure. See also check disk space on Linux for df and du patterns on other distros.

bash
df -h /
du -sh ~/.cache /var/cache/apt/archives /var/log 2>/dev/null
journalctl --disk-usage

On my test host:

text
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv   58G   42G   14G  76% /
1.1G	/home/golinuxcloud/.cache
400M	/var/cache/apt/archives
262M	/var/log
Archived and active journals take up 176.6M in the file system.

On a desktop, open Disk Usage Analyzer (baobab, package baobab):

bash
baobab

Version on Ubuntu 25.04: baobab 48.0. It helps you find large directories interactively; it does not delete files for you.


Clean Ubuntu with apt (no extra tools)

This is the baseline every admin should know before adding BleachBit or Ubuntu Cleaner.

apt clean — drop cached package files

Preview what clean would delete:

bash
sudo apt-get clean --dry-run
text
Del /var/cache/apt/archives/* /var/cache/apt/archives/partial/*
Del /var/lib/apt/lists/partial/*
Del /var/cache/apt/pkgcache.bin /var/cache/apt/srcpkgcache.bin

Run it:

bash
sudo apt clean

On my system /var/cache/apt/archives went from 400M to 40K. Installed packages stay on disk; only the download cache disappears.

apt autoclean — remove outdated cached debs

bash
sudo apt autoclean

Useful when older .deb versions pile up; often returns quickly if the cache is already empty.

apt autoremove — drop orphaned dependencies

Preview:

bash
sudo apt autoremove --dry-run
text
0 upgraded, 0 newly installed, 0 to remove and 38 not upgraded.

When packages would be removed, read the list before you confirm. After removing a large app such as LibreOffice, autoremove is where libuno and similar libraries actually leave.

Combined one-liner

bash
sudo apt clean && sudo apt autoclean && sudo apt autoremove -y

Trim systemd journal logs

Logs live under /var/log/journal and show up in journalctl --disk-usage. There is no --dry-run for vacuum—pick a limit explicitly:

bash
journalctl --disk-usage
sudo journalctl --vacuum-time=7d
# or cap size:
sudo journalctl --vacuum-size=200M

Do not vacuum to zero on a machine you are actively troubleshooting; keep enough history to debug service failures.


User cache and Snap revisions

Application caches under ~/.cache are safe to delete selectively when you accept that apps may rebuild them on next launch. Inspect size first:

bash
du -sh ~/.cache/*

Old Snap revisions show as disabled in:

bash
snap list --all | awk '/disabled/{print $1, $2}'

Remove a specific revision (example—use your name and revision from the list):

bash
sudo snap remove firefox --revision=8462

Repeat for each disabled revision you do not need. This is often worth hundreds of megabytes on desktop systems that auto-refresh snaps.


BleachBit — disk cleaner in Ubuntu universe

BleachBit is the closest widely packaged equivalent to Windows “disk cleanup” utilities on Ubuntu. It clears caches and junk files; it is not antivirus—see does Ubuntu need antivirus? if you need malware scanning. It is in universe on Ubuntu 25.04:

bash
sudo apt update
sudo apt install -y bleachbit
bleachbit --version
text
BleachBit version 4.6.2

List cleaners:

bash
bleachbit --list | grep '^apt'
text
apt.autoclean
apt.autoremove
apt.clean
apt.package_lists

Preview before you delete

Always preview. Example for user caches:

bash
bleachbit --preview system.cache 2>&1 | head -10
text
Delete 12.3kB /home/golinuxcloud/.cache/seaborn/tips.csv
Delete 4.1kB /home/golinuxcloud/.cache/uv/interpreter-v4/...
...

apt.package_lists can delete files under /var/lib/apt/lists/—that frees space but forces a full sudo apt update before the next install. Preview showed multi-megabyte index files on my host:

bash
bleachbit --preview apt.package_lists 2>&1 | head -5

Run a clean only after you are satisfied with the preview:

bash
bleachbit --clean apt.clean
# GUI:
bleachbit --gui

After I had already run apt clean, bleachbit --preview apt.clean reported 0B recoverable—expected, not a BleachBit failure.


Ubuntu Cleaner — janitor app from PPA

Ubuntu Cleaner is a GTK janitor inspired by the old Ubuntu Tweak cleaner. It is not in the default Ubuntu archive; install from ppa:gerardpuig/ppa:

bash
sudo apt install -y software-properties-common
sudo add-apt-repository -y ppa:gerardpuig/ppa
sudo apt update
sudo apt install -y ubuntu-cleaner

On Ubuntu 25.04:

text
ubuntu-cleaner:
  Candidate: 1.1.4-1
        500 https://ppa.launchpadcontent.net/gerardpuig/ppa/ubuntu plucky/main amd64 Packages

Launch from the app menu or run:

bash
ubuntu-cleaner

CLI options are limited:

text
Usage: ubuntu-cleaner [options]
  --version    show program's version number and exit
  -h, --help   show this help message and exit
  -d, --debug  Generate more debugging information.

Version on install:

text
ubuntu-cleaner 1.1.4

Inside the GUI you pick categories (package caches, application caches, browser data—depending on plugins). There is no batch --preview flag; use the on-screen selections the same way you would in BleachBit’s GUI.

Caveats on current Ubuntu releases

The PPA build dates to 2022. Install may print Python SyntaxWarning lines from oldkernel_plugin.py. On launch you may see missing icon warnings (computerjanitor, gtk-execute) with the Adwaita theme—the window can still open on a full desktop session. Ubuntu Cleaner needs a graphical session; it is not a server tool.

For SSH-only hosts, use BleachBit CLI or plain apt/journalctl instead.


Ubuntu cleaning before imaging or cloning

When you prepare a VM template or golden image:

  1. sudo apt clean && sudo apt autoremove -y
  2. sudo journalctl --vacuum-time=3d (or your retention policy)
  3. Remove disabled snap revisions
  4. Empty Trash and clear ~/.cache only if the template should not ship user data
  5. Optional: BleachBit preview for browsers and thumbnails

You do not have to install Ubuntu Cleaner solely for imaging—CLI steps above shrink the image reliably. GUI cleaners are convenience, not a requirement.


Remove Ubuntu Cleaner or BleachBit

bash
sudo apt remove ubuntu-cleaner bleachbit
sudo apt autoremove -y

Drop the PPA if you added it only for Ubuntu Cleaner:

bash
sudo add-apt-repository --remove ppa:gerardpuig/ppa
sudo apt update

Troubleshooting

Symptom Likely cause Fix
apt update fails after BleachBit apt.package_lists Package indexes deleted Run sudo apt update to rebuild lists
Unable to locate package ubuntu-cleaner PPA not added sudo add-apt-repository ppa:gerardpuig/ppa then apt update
PPA has no plucky suite Old Ubuntu or typo Use correct codename; check ls /etc/apt/sources.list.d/
ubuntu-cleaner exits on SSH GTK app needs display Use bleachbit CLI or apt commands on servers
journalctl: unrecognized option '--dry-run' Not supported Use --disk-usage first; vacuum with explicit size/time
Freed little space after “clean all” Data is in $HOME or Docker du -sh ~/*; prune containers/images separately
zsh glob errors on apt patterns Shell expansion Quote patterns passed to apt

References


Summary

For Ubuntu cleaning, start with df, du, and journalctl --disk-usage, then run sudo apt clean, sudo apt autoremove -y, and targeted journal vacuum. Install BleachBit from universe when you want previews and scripted cleaners (bleachbit --preview, bleachbit --clean). Add Ubuntu Cleaner from ppa:gerardpuig/ppa only if you want a simple janitor GUI—version 1.1.4 on plucky, GUI-only, older but functional. Preview every GUI category before you wipe apt lists or browser data, and keep CLI maintenance as the foundation even when you install a disk cleaner app.


Frequently Asked Questions

1. What is the best disk cleaner for Ubuntu?

For most users, built-in apt maintenance plus BleachBit from universe is enough. Run sudo apt clean, sudo apt autoremove, and preview BleachBit cleaners before deleting. Ubuntu Cleaner from the gerardpuig PPA is an optional GTK app for the same janitor-style tasks if you prefer its layout.

2. How do I install Ubuntu Cleaner on Ubuntu?

Ubuntu Cleaner is not in the default repos. Add sudo add-apt-repository ppa:gerardpuig/ppa, run sudo apt update, then sudo apt install ubuntu-cleaner. On Ubuntu 25.04 the PPA publishes a plucky suite with version 1.1.4-1.

3. Is BleachBit better than Ubuntu Cleaner?

BleachBit ships in Ubuntu universe, has CLI preview and clean flags, and is actively packaged for current releases. Ubuntu Cleaner is GUI-only and last updated in the PPA around 2022. BleachBit is the better default for scripting and servers; Ubuntu Cleaner suits desktop users who want a simple janitor window.

4. Is it safe to run apt clean on Ubuntu?

Yes. apt clean removes downloaded .deb files from /var/cache/apt/archives. You can always re-download packages on the next apt install. It does not remove installed software. Run apt autoclean instead if you only want to drop obsolete package files.

5. How do I clear systemd journal logs safely?

Check size with journalctl --disk-usage. Trim with sudo journalctl --vacuum-time=7d or sudo journalctl --vacuum-size=200M. journalctl has no --dry-run flag—pick a time or size limit you are comfortable with before running vacuum.

6. Do I need a disk cleaner before imaging a Ubuntu VM?

Helpful but not mandatory. Clear apt caches, shrink journals, remove disabled snap revisions, and empty Trash so the image is smaller. Always preview GUI cleaners and avoid deleting browser passwords or SSH keys unless you intend to.

7. How do I uninstall Ubuntu Cleaner?

Run sudo apt remove ubuntu-cleaner && sudo apt autoremove. Remove the PPA with sudo add-apt-repository --remove ppa:gerardpuig/ppa if you no longer need updates from that source.

8. Why does Ubuntu Cleaner show missing icon warnings?

The package targets older GTK icon names such as computerjanitor. On modern Adwaita themes those icons may be absent. The app can still launch; warnings on the terminal are cosmetic unless the window fails to open entirely.
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels across development, DevOps, …

  • Red Hat Certified System Administrator in Red Hat OpenStack
  • Certified Kubernetes Application Developer (CKAD)
  • Red Hat Certified Specialist in Ansible Automation
  • Go (programming language)
  • Python (programming language)
  • DevOps
  • Computer Security