If handled carelessly, the task of removing an installed package from any operating system can undoubtedly become a problem. This is because whenever you try to remove a package, you expect it to leave no trace. In other words, you want to completely remove the desired package. However, such a complete removal cannot be achieved without taking certain measures.
Therefore, today’s article will focus on a way to completely remove a package in Linux.
Note This procedure is suitable for older versions of Ubuntu such as 18.04, 16.04, etc.
Method to completely remove a package in Linux Mint 20:
To completely remove a package in Linux Mint 20, you need to complete the following series of steps in the order shown:
Step # 1: List all installed packages in Linux Mint 20:
First, you need to know which package you want to remove. To do this, you can try listing all installed packages on your Linux Mint 20 system. Then, from that list, you can easily determine which package you want to completely remove. To list all installed packages in Linux Mint 20, you must run the command shown below in a terminal:
apt list --installed
From the list of installed packages on our Linux Mint 20 system, you can easily select any package you want to completely remove from your Linux Mint 20 system. We will remove the “tcpreplay” package from our Linux Mint 20 system by following the steps below.
Step # 2: remove the package from Linux Mint 20
The first command we’ll run in this regard will simply remove a specific package without its config files. To do this, use the following command:
sudo apt-get remove PackageName
Here you can replace PackageName with the name of the corresponding package you want to remove. In our case, the package we wanted to remove was “tcpreplay”.
After you execute this command, you will be prompted to confirm your action by typing “Y” and then pressing the Enter key, as shown in the image below. However, if you want the removal process to go smoothly without asking for any confirmation, you can use the “-y” flag after the “remove” command.
Step # 3: Remove the configuration files of the specified package from Linux Mint 20
When the specified package has been successfully removed from your Linux Mint 20 system, the next step is to remove its configuration files using the command shown below:
sudo apt-get purge PackageName
Here you can replace PackageName with the name of the corresponding package whose configuration files you want to remove. In our case, the package configuration file we wanted to remove was “tcpreplay”.
After the configuration files of the specified package are removed from your Linux Mint 20 system, you will see messages on your terminal.
Step # 4: Remove all unnecessary packages and dependencies from Linux Mint 20
Finally, the last step is to clean up any unnecessary and unused packages and dependencies from your Linux Mint 20 system that were installed along with the said package. After removing a package, you no longer need these packages and dependencies. To get rid of them, you can run the command shown below:
sudo apt-get autoremove
When this command successfully tries to remove all unused packages and dependencies from your Linux Mint 20 system, you will be able to say that the package you specified has been completely removed.
In this article, you walked through the process of completely removing a package in Linux Mint 20. The same method can be used on a Debian 10 or Ubuntu 20.04 system.