This article may look the same as the one my partner Isaac just published a few minutes ago, but it is not. His article explained to us how to free up space and in this we are going to focus on another type of cleaning. When we uninstall a program in Linux, it usually leaves traces and what we are going to explain here is how to remove residual files after uninstalling an application on Linux, for which we have several options.
For some years now, in Linux we have what are known as new generation packages. With Flatpak and Snap in the lead, although there are also AppImage, these are packages that include main software and dependencies in the same package, which means that they are cleaner than their counterparts in repositories. Still, they can leave some remains and in this article you will learn everything you need so that you only have what you need installed on your computer.
Table of Contents
The different ways to delete residual files in Linux
Especially when we get the software online, there are many apps that include how to delete the residual files in a file that is usually called "Install" or "Readme". This is something that we cannot find when we have installed the software from official repositories, but there are general ways to clean as much as possible, such as the following:
To remove a software and all its related files, we have to execute the following command:
sudo apt purge nombre-del-paquete
From the above command, we have to change "package-name" to the package in question, which for VLC would be "sudo apt purge vlc" (without the quotes). Once the command has been written, pressed Enter and entered our password, it will read, it will show us the packages to be removed and it will ask us, at which point we will have to press Y (es) or Y (í) followed by Enter to eliminate all the waste that we had left of that application and we no longer need.
If we are used to using the "apt remove" command to remove software in Linux, we will be left with a lot of residual files. We can eliminate them all at once with the following command:
sudo apt autoremove
As with purge, it will perform the reading, it will show us what it is going to delete and it will delete it. It seems important to mention that this command will remove old kernel versions as well, so it must be taken into account if we want to keep them for any reason.
If your distribution uses YUM instead of APT, the command will be different. The command to VLC would be the following:
sudo yum remove vlc
If we have installed packages using the groups function from YUM, we will have to delete them as a group using this other command:
sudo yum remove @"nombre del grupo"
Option with GUI: Synaptic
If we don't like the terminal, we also have user interface options like Synaptic. It is a package manager that many of us will know because it was included by default in popular Linux distributions such as Ubuntu. If we do not have it installed by default, we can do it from our software center or with the following command:
sudo apt install synaptic
Once we start it, it will ask us to enter our user password because it needs privileges to make the changes. And to completely remove an app, we just have to do the following:
- We look for it from the magnifying glass icon (Search).
- We right click on it
- We choose the option «Mark to uninstall completely».
- In the window that appears with the related packages, we click on "Mark".
- Finally, we click on «Apply».
Delete residual configuration files
Uninstalling the applications does not clean everything related to them; there are still likely to be configuration files. To eliminate them, we have to navigate and look for the name of the app in these paths (where ~ / is our personal folder and the folders with a dot in front are hidden):
- / usr / bin
- / Usr / lib
- / usr / local
- / usr / share / man
- / usr / share / doc
- / var
- / run
- / lib
- ~ / .cache
- ~ / .local
- ~ / .local / share
- ~ / .thumbnail
- ~ / .config /
- Flatpak packages usually clean everything up automatically, but Snap packages leave their configuration files at ~ / snap.
And so we can have our Linux-based operating system clean of residual packages.