CleanMate

All guides · Ubuntu · Updated

How to free up disk space on Ubuntu: a safe, step-by-step guide

Free up space on Ubuntu without breaking anything: check what takes space with df and Disk Usage Analyzer, then empty the Trash, clean the apt cache, remove old kernels, shrink the journal, clear snap and Flatpak leftovers, caches, large and duplicate files, and Downloads.

Install on Ubuntu — free and open source

CleanMate for Ubuntu after a scan, listing what it can clean to free up disk space, with sizes

Ubuntu warns that the disk is low on space, or apt fails because /boot is full. This guide goes through the places that fill an Ubuntu system, in the order worth checking, with the safe command or click for each. Every step is short and links to a full guide.

One rule for all of them: what can be downloaded or made again (package caches, logs, thumbnails) can be deleted; your own files should go to the Trash first, so you can still restore them.

1. See what takes space

df -h /            # free space on the root filesystem
df -h /boot        # if /boot is a separate partition

Then open Disk Usage Analyzer (Baobab, in the app grid) and scan your home folder or the whole disk: it draws each folder by size, so the big ones stand out. Without a desktop, ncdu does the same in the terminal (sudo apt install ncdu, then ncdu ~). More ways: Find large files on Ubuntu. To walk the whole disk folder by folder: find what is using disk space from the terminal. If df shows free space but Ubuntu still says the disk is full, see why the disk looks full when df shows space.

2. Empty the Trash

Files deleted in Files (Nautilus) go to ~/.local/share/Trash and still take space. Open Trash in the sidebar, restore what you want, then click Empty. A USB drive keeps its own Trash folder (.Trash-1000) until you empty it while the drive is plugged in: USB drive still full after deleting files.

3. Clean the apt cache and unused packages

apt keeps every package it downloaded, and leaves behind dependencies nothing uses anymore:

sudo apt clean            # delete downloaded .deb files; apt fetches them again if needed
sudo apt autoremove       # remove packages nothing depends on, including old kernels

Read the list autoremove shows before you confirm.

4. Old kernels and a full /boot

Each kernel update keeps the previous one, and a small /boot partition fills up until apt can’t install updates. sudo apt autoremove --purge removes old kernels and keeps the running one and a fallback. If apt is already stuck because /boot is full, follow Ubuntu /boot full: remove old kernels.

5. Shrink the systemd journal

System logs can grow to several GB. See their size and keep only the last two weeks:

journalctl --disk-usage
sudo journalctl --vacuum-time=2weeks

To cap it for good and clear rotated logs in /var/log, see the systemd journal, /var/log and the apt cache. Spotify’s cache and offline downloads: Spotify, Apple Music, Podcasts and YouTube Music downloads and cache.

6. Old snap revisions and unused Flatpak runtimes

snap keeps older versions of every snap app, and Flatpak keeps runtimes no app uses anymore:

snap list --all | grep disabled          # old revisions
flatpak uninstall --unused               # runtimes no app needs

How to remove old snap revisions safely and limit how many are kept: snap and Flatpak taking up disk space.

7. Clear caches

Apps keep caches in ~/.cache, and the file manager keeps a preview of every image in ~/.cache/thumbnails. Quit an app before deleting its cache folder; a running app may need it. Step by step: How to clear the cache on Ubuntu. Browsers are best cleared from their own settings: Browser cache, history and cookies. If you play games, Steam and Proton keep their own: Steam, Proton and shader cache, and Steam’s and Minecraft’s caches and logs: game launcher caches. Dropbox, Nextcloud and MEGAsync keep sync caches and logs: cloud sync caches.

8. Find large files

Disk Usage Analyzer from step 1 shows the folders; to list the files themselves:

find ~ -type f -size +1G -exec ls -lh {} \; 2>/dev/null

Look at what you find before moving it to the Trash. More: Find large files on Ubuntu.

9. Remove duplicate files

fdupes -r ~/Pictures (sudo apt install fdupes) lists identical files. Keep one copy, check that it opens, trash the others. Hard links share space, so deleting one frees nothing. How to do it safely: Find and delete duplicate files. Photos that look alike but differ need a different mode: similar photos and burst shots.

10. Clean up Downloads

.deb files, AppImages and ISO images you already used, and unfinished .crdownload or .part downloads, can usually go. Sort Downloads by size in Files and look at the oldest first. Details: Clean up the Downloads folder.

11. Uninstall apps you don’t use

Remove apps from App Center (Ubuntu Software), or with sudo apt remove <package>, snap remove <name> or flatpak uninstall <id>. Their folders in your home often stay behind: Uninstall apps completely.

If you write code

Docker, node_modules, language caches and old SDKs can take more than everything above. They have their own guide: Free up disk space on Ubuntu as a developer.

How CleanMate does it

CleanMate is a free, open-source cleaner for Ubuntu that does these steps in one scan and shows everything before it removes anything (all Ubuntu features):

Two frequent cases have their own guides: Timeshift snapshots filling the disk and a Trash that will not empty.

Want this on a schedule, with a warning when the disk runs low? Read automatic cleanup and the low-disk alert on Ubuntu, and what can still be restored if a clean took something you needed.

FAQ

Is sudo apt clean safe? Yes. It deletes only downloaded package files; installed software is not touched.

Can I delete everything in ~/.cache? Not while apps are running, and not in one go: a few apps keep unsynced files there. Clear it folder by folder after quitting the app.

Why is the disk still full after I deleted files? They are in the Trash, a program still holds them open (restart it), or they were hard links that shared space.

Looking for a BleachBit alternative for Ubuntu? See how CleanMate compares, feature by feature.

Skip the commands

Open source — star it on GitHub: CleanMate for Ubuntu

How CleanMate decides what is safe to remove →