CleanMate

All guides · Ubuntu · Updated

Uninstall an app on Ubuntu and remove its leftover config files: apt purge vs remove, ~/.config

What apt remove keeps and apt purge deletes, what neither touches in your home folder (~/.config, ~/.local/share, ~/.cache), and how to find and delete the leftovers of apps you already removed, with the commands.

Install on Ubuntu — free and open source

CleanMate Uninstaller on Ubuntu listing apps with their size and when they were last used

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:

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.

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.

Skip the commands

Open source — star it on GitHub: CleanMate for Ubuntu

How CleanMate decides what is safe to remove →