The task of removing an installed package from any operating system can surely be a hassle if handled carelessly. It is because whenever you attempt to remove a package, you expect it not to leave any of its traces behind. In other words, you want a clean removal of the desired package. However, such a complete removal cannot be achieved without taking certain measures.
That is why today’s article will be focused on the method of completely removing a package in Linux.
Note: The method that we have attempted and shared with you in this article has been performed on a Linux Mint 20 system. However, the very same steps can also be performed on Ubuntu 20.04 and Debian 10.
Method of Completely Removing a Package in Linux Mint 20:
For removing a package completely in Linux Mint 20, the following series of steps should be performed in the specified order:
Step #1: List Down All the Installed Packages in Linux Mint 20:
First, you should know which package you want to remove. For that, you can try listing down all the installed packages on your Linux Mint 20 system. Then from this list, you can easily figure out which package you want to remove completely. For listing down all the installed packages in Linux Mint 20, you have to execute the command shown below in the terminal:
The list of all the installed packages on our Linux Mint 20 system is shown in the following image:
From this list, you can conveniently pick any package that you want to remove completely from your Linux Mint 20 system. We will be removing the “tcpreplay” package from our Linux Mint 20 system in the steps shown below.
Step #2: Remove a Package from Linux Mint 20
The first command that we will execute in this regard will simply remove a particular package without its configuration files. For this purpose, the following command is used:
sudo apt-get remove PackageName
Here, you can replace PackageName with the name of the respective package that you want to remove. In our case, the package that we wanted to remove was “tcpreplay”.
Once you execute this command, you will be prompted to confirm your action by typing “Y” and then hitting the Enter key, as shown in the image below. However, if you want the removal process to go smoothly, without asking for any confirmation, then you can use the “-y” flag after the “remove” command.
When the specified package is removed successfully, you will see the messages resembling the ones shown in the following image on your terminal:
Step #3: Remove the Configuration Files of the Said Package from Linux Mint 20
When the specified package has been removed successfully from your Linux Mint 20 system, the next step is to delete its configuration files with the command shown below:
sudo apt-get purge PackageName
Here, you can replace PackageName with the name of the respective package which configuration files you want to remove. In our case, the package configuration files we wanted to remove was “tcpreplay”.
Once the configuration files of the specified package have been removed from your Linux Mint 20 system, you will see the messages resembling the ones shown in the following image on your terminal.
Step #4: Remove all the Irrelevant Packages and Dependencies from Linux Mint 20
Finally, the last step is to clean up all the irrelevant and unused packages and dependencies from your Linux Mint 20 system that got installed along with the specified package. After the removal of the package, you will not need those packages and dependencies anymore. To get rid of them, you can execute the command shown below:
When this command successfully attempts to remove all the unused packages and dependencies from your Linux Mint 20 system, you will be able to say that your specified package has been completely removed.
Today’s guide walked you through the procedure of completely removing a package in Linux Mint 20. The same method can also be used on a Debian 10 or Ubuntu 20.04 system.