When you uninstall a program in Ubuntu, sometimes bits and pieces like configuration files are left behind. Occasionally this is a good thing, like when you remove a program due to some issues you’re having with it and then reinstall it again, since your old settings are usually restored.
But more often than not, when a program is uninstalled it is because the user doesn’t want it, so any remaining configuration files are just wasting space. And often in the case of trying to reinstall a program to get it to work properly, a configuration setting is what is causing the issue, so a complete removal is needed.
There are 2 ways to go about this: via the user-friendly GUI of Synaptic (or your preferred package manager), or the much faster way of command-line in a terminal.
Either way, you’ll of course need to know the name of the program, and if possible the actual package name. While often the package name is the same as the program’s displayed name, but in lowercase, this isn’t always the case, so if unsure check out these ways of finding out.
If you want to use Synaptic, open it and enter the name of the program or package in the Quick search bar. When it and related packages appear, right-click the main package and choose “Mark for Complete Removal“.
It is usually fairly easy to tell which is the main base package; if the name isn’t a give-away, the information after it should clear things up. For example, AbiWord is actually abiword, so is instantly recognisable from the other packages that install with it.
When you “Mark for Complete Removal“, you will be informed if other packages also need to be removed, meaning you don’t have to do this manually.
When you accept the proposed changes, you will see that the program and additional packages will be removed. If there are other related packages that haven’t been automatically selected, you can do so manually before proceeding.
When ready, simply click the Apply button in the Synaptic toolbar. You will receive a final request for confirmation, after which the program will be removed, along with the extra packages and any configuration files.
As in the case of the AbiWord example, not everything is always automatically selected for removal, so it pays to look through the search results and see if anything needs to be removed manually (abiword-common is actually larger than the other packages combined at nearly 9Mb). Doing this before proceeding with the last step will save you coming back later.
If you prefer the quicker command-line method, open a terminal and enter:
sudo apt-get purge packagename (replacing “packagename” with the actual name of the package in question).
If you’re familiar with apt-get remove and wondering what is the difference, especially since additional packages are also marked for removal, the answer is that configuration files are often left behind if you simply “remove” the app. To get that command to work, the
--purge option needs to be added (eg: sudo apt-get remove
--purge packagename). You will still see much mention online that this is the way to do it, but since then the purge command has been added to apt-get, so this is no longer needed (though for backwards compatibility, remove
--purge will continue to work).
Either way you choose to do it, you should be able to get rid of all the junk that programs can leave behind when simply removed. Just keep in mind that if you ever saved any settings or user profiles etc, occasionally these can still be left behind, but they will be in config folders within your home folder (you might need to enable displaying of hidden files and folders). If you ever get a message that a certain folder could not be removed, or a certain file, just go in there later and remove it.
Leave some unwanted packages behind? It’s actually pretty easy to get rid of the vast majority of packages that weren’t automatically selected for removal. When you install via the terminal, you will notice that a list of orphaned packages is presented along with the simple command to remove them all in one go.
As you can see in the example, after uninstalling AbiWord the abiword-common package was left behind (not to mention a few libraries), but you can easily remove it and others taking up space with the following command:
sudo apt-get autoremove
Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!