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:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/02/echo/image5-18.png" data-lazy- height="24" src="data:image/svg xml,” width=”409″>

The list of all the installed packages on our Linux Mint 20 system is shown in the following image:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/02/echo/image7-15.png" data-lazy- height="411" src="data:image/svg xml,” width=”643″>

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”.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/02/echo/image6-15.png" data-lazy- height="27" src="data:image/svg xml,” width=”480″>

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.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/02/echo/image9-13.png" data-lazy- height="160" src="data:image/svg xml,” width=”548″>

When the specified package is removed successfully, you will see the messages resembling the ones shown in the following image on your terminal:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/02/echo/image8-14.png" data-lazy- height="228" src="data:image/svg xml,” width=”592″>

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”.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/02/echo/image2-24.png" data-lazy- height="24" src="data:image/svg xml,” width=”474″>

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.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/02/echo/image1-25.png" data-lazy- height="126" src="data:image/svg xml,” width=”534″>

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:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/02/echo/image4-20.png" data-lazy- height="23" src="data:image/svg xml,” width=”429″>

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.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/02/echo/image3-21.png" data-lazy- height="117" src="data:image/svg xml,” width=”521″>

Conclusion

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.

About the author

<img alt="Karim Buzdar" data-lazy-src="https://kirelos.com/wp-content/uploads/2021/02/echo/karim-150×150.png6036760248343.jpg" height="112" src="data:image/svg xml,” width=”112″>

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.