Linux: How to Completely Remove ALL Traces of a Program?

Solution 1:

In short, you're looking for something along the lines of "Fedora Silverblue", which is designed to have the base OS more-or-less immutable. As in, it doesn't allow you to install apps system-wide at all. You can still install apps to your user account, but only through Flatpak, and Flatpak enforces that all configuration for an app lives in exactly one place.


For desktop apps that were installed system-wide, the request is practically impossible. A traditional package manager can be better or worse at removing no-longer-needed dependencies (e.g. Arch's pacman is slightly better than apt); however, it will never touch files that the app has left in your home directory, such as settings or data stored within the app.

  • It might not have access to every user's home directory, especially if they are encrypted. (Even today, plenty of family desktops have multiple user accounts.)

  • It cannot precisely distinguish between "wanted" and "unwanted" traces. For example, the color scheme is obviously just a setting that can be purged, while documents created with the app must generally be preserved – removing LibreOffice shouldn't delete all .doc files on the system.

    But there are also many things in between, such as chat logs or browser bookmarks which are stored as internal "app data" yet they're also something that many users would prefer to keep. There are also apps which store all their data internally, such as note-taking software.

The same problem exists on Windows in the same way. Some programs on Windows give you the illusion of cleaning up after themselves, if you uninstall them they ask whether to delete your settings – but even if you answer "yes", they won't be able to do anything with other users on the same computer. (And because the app is now removed, those users can't just uninstall it again, either.)

That being said, nearly all apps store their data in the same 2–3 places:

  • Your data in ~/.local/share/myapp, settings in ~/.config/myapp, and temporary files in ~/.cache/myapp (all together being the Linux equivalent of Windows "AppData");
  • For older apps – a hidden ~/.myapp right in the home directory, containing a mix of everything.
  • And sometimes a few settings in dconf-editor, roughly the GNOME Desktop Environment's equivalent of Windows Registry.

So overall it's again the same as in Windows – in order to truly get rid of all traces, first you uninstall the actual app, then you remove its directory under AppData ~/.config and ~/.cache, finally clean up Registry dconf. (GNOME's dconf has considerably less stuff than Registry – all data belonging to an app is always in one spot.)

However, a more reliable solution would be to install such apps not system-wide through 'apt' but instead using Flatpak from Flathub, which is more or less the Linux equivalent of Microsoft Store. Usually, an app installed through Flatpak is required to store everything in designated locations – it can't scatter files through your home directory but has to use ~/.var/myapp and nothing else.

Additionally, Flatpak has much less granular package dependencies – an app can only depend on a single "runtime" instead of a hundred libraries.

(Ubuntu has "Snap Store" which is somewhat similar, but as far as I know it doesn't exactly have the same filesystem isolation.)