You removed an app on Ubuntu and the disk did not shrink the way you expected. Two things stay behind: the system configuration of a .deb package that you removed but did not purge, and the settings, data and caches the app wrote in your home folder.
This guide covers both, with the commands, and ends with what CleanMate does about each. For other package formats and for a Mac, see How to uninstall an app completely on Mac and Ubuntu.
apt remove vs apt purge
| Command | Program files | Config in /etc |
Your home folder |
|---|---|---|---|
sudo apt remove <pkg> |
deleted | kept | untouched |
sudo apt purge <pkg> |
deleted | deleted | untouched |
sudo apt autoremove --purge |
removes packages nothing needs any more, and their config | deleted | untouched |
So purge is the thorough one for /etc, but neither command touches ~/.config, ~/.local/share or ~/.cache: those belong to you, not to the package.
Packages that were removed but not purged show up as rc in dpkg:
dpkg -l | grep '^rc' # removed, config still installed
sudo apt purge <name> # one of them
dpkg -l | awk '/^rc/ {print $2}' | xargs sudo apt purge -y # all of them, read the list first
Config files are small, usually kilobytes, so purging frees little space. It matters for a clean system: an old /etc file can make a reinstall start with stale settings.
Before you run apt purge, run it as a simulation, so you see what else would go:
apt -s purge <pkg>
If the list contains ubuntu-desktop, gnome-shell or other things you did not expect, stop: dependencies were pulled in by a metapackage.
Snap and Flatpak
sudo snap remove --purge <name> # no 31-day data snapshot
flatpak uninstall --delete-data <app-id> # also ~/.var/app/<app-id>
flatpak uninstall --unused # runtimes no app needs
Without --purge, snap keeps a snapshot of the app’s data for 31 days (snap saved lists them). Without --delete-data, Flatpak keeps ~/.var/app/<app-id>.
The leftovers in your home folder
Apps write in these places, in a folder named after the app:
| Folder | What it holds |
|---|---|
~/.config/<app> |
settings, sometimes sign-in sessions |
~/.local/share/<app> |
data: databases, extensions, history |
~/.local/state/<app> |
logs and state |
~/.cache/<app> |
cache; always safe to delete |
Look for an app by name and see the sizes:
ls -d ~/.config/*name* ~/.local/share/*name* ~/.local/state/*name* ~/.cache/*name* 2>/dev/null
du -sh ~/.config/Code ~/.cache/google-chrome 2>/dev/null
Delete only the folders of an app you no longer use, with the app closed: rm -r ~/.config/<app>. Be careful with three things:
- Do not delete
~/.config,~/.localor~/.cachethemselves, or folders the desktop shares (dconf,gtk-3.0,fonts,keyrings,pulse). - A folder named like a command-line tool you still use is not a leftover:
~/.config/git,~/.config/nvim,~/.config/htop. - Keep the data you may want back. A password manager, a database client or an editor can hold things you never saved elsewhere. Moving the folder away for a week is a safer test than deleting it.
How CleanMate does it
The Uninstaller is in the desktop app and the terminal app (Ubuntu features). It lists every apt, Snap and Flatpak app you can open, plus AppImage apps with a launcher, with the real size (the app plus its folders in your home) and when you last used it.
- Removing apps. Tick one app or several, for example everything unused for 12 months, and remove them with one confirmation and one password. apt apps go through
apt-get purge, snaps throughsnap remove --purge. Running apps are skipped, and a removal that would take something Ubuntu needs (GNOME Shell, the login screen,sudo, the running kernel) is refused. - The app’s own folders. Afterwards CleanMate offers the app’s folders in your home for the Trash, never folders other apps share, and you can put them back with Restore folders.
- Leftovers of removed apps. The last row lists
~/.var/app/<id>of a Flatpak app and~/snap/<name>of a snap that are gone, and folders in~/.config,~/.local/share,~/.local/stateand~/.cachewhose name matches no package, snap, Flatpak app, launcher, command or running program. Nothing is ticked, and they go to the Trash. Folders the desktop shares, folders with programs in them, folders changed in the last 30 days and folders with an open file are never listed. - Packages removed but not purged. In Smart Scan › System Junk, Leftover package configs purges the
rcpackages above. - Reset. The app stays installed and its folders in your home go to the Trash, so it starts as if new. It is refused while the app runs.
CleanMate does not touch the hidden configuration of command-line tools, your shell files or your keys (~/.ssh, ~/.gnupg). To see what else a developer’s Ubuntu keeps, read Free up disk space on Ubuntu as a developer. To disable or remove leftover autostart items, see the startup items page.
FAQ
What is the difference between apt purge and apt remove? remove deletes the program and keeps its configuration files in /etc; purge deletes both. Neither touches the settings in your home folder.
Does apt purge delete my data in ~/.config? No. Those folders belong to your user and stay until you delete them. Use the commands above, or the Uninstaller’s leftovers list.
Is apt autoremove safe? Usually, because apt only removes packages it installed as dependencies and that nothing needs now. Read the list it prints. apt autoremove --purge also deletes their config.
How do I know a folder in ~/.config is a leftover? Check that no installed package, snap, Flatpak app or command has that name (dpkg -S, command -v <name>), and that the folder has not changed recently. If you are not sure, move it away instead of deleting it.
