0

Is there a way to completely remove ALL traces of a program in Linux?

I've researched a lot on this, and I've seen people talk about apt-get remove packagename, apt-get purge packagename, apt-get remove --purge packagename, and apt-get autoremove, but it sounds like all of these leave configuration files or other traces of some sort.

I want to remove EVERYTHING, though. I'm talking uninstall and completely remove the program, the package, all dependencies, all configuration files, and all data files. Remove everything associated with the program, leaving the system like the program was never installed and never existed.

I'm looking to switch to Linux as my main OS (from Windows), but for me to sleep soundly at night, I need to know that when I uninstall something, everything associated with that thing is gone. I know it's weird. But you know, we all have our needs.

Please help me out here; I could even pick a distro based on this, if I had to.

Thanks, and have a wonderful day!

1

1 Answer 1

4

Debian distinguishes between removing a package (which leaves its conf files behind, in case you re-install it later) and purging a package (which removes the package and its conf files).

apt-get purge package
apt-get --purge autoremove

or, as @StephenKitt mentions in a comment, this can be done with just one command:

apt purge --autoremove package

This will first purge the package (i.e. remove it and all its conf files), and then purge any other packages that:

  • were installed automatically as a dependency of a package (the package you're purging OR some other package) or have since been marked as auto with apt-mark auto packagename.

and

  • aren't required by any other currently-installed package(s)

NOTE: This will not remove any files created by the package that aren't part of the package itself. e.g. if you apt purge vim, it won't purge any text files created by vim. Package managers manage packages, they don't manage your personal files. If you want such files deleted too, you'll have to find and delete them yourself.

Also note: It won't remove any mentions of the package in the system logs. In fact, installing and removing/purging packages generates log entries in /var/log/dpkg.log and/or in /var/log/apt/

Another thing to consider is that if you have etckeeper installed (and you should because it's extremely useful and can save your bacon in disastrous situations), traces of any purged packages (at least, those which have config files in /etc) will be left in /etc's revision history (via git or whatever etckeeper is configured to use).

When etckeeper is installed, git commit is run daily from cron and apt is configured to run git commit whenever packages are installed, upgraded, or uninstalled.

3
  • Thank you for your detailed comment. When you say that it won't remove any mentions of the package in system logs, is that the same as alterations made to $HOME ? Commented Jul 8, 2021 at 18:58
  • @user15088299 what? this question makes no sense. System logs have nothing at all to do with $HOME. And packages in general don't have files in normal user home directories.
    – cas
    Commented Jul 9, 2021 at 4:34
  • I have heard that there are sometimes changes to $HOME when installing software Commented Jul 9, 2021 at 18:47

Not the answer you're looking for? Browse other questions tagged .