How To Completely Remove Package on Ubuntu

Completely Remove Package on Ubuntu

We usually install lots of different packages in our Ubuntu system, the most common way to install packages is either the apt-get command or the synaptic package manager. Whenever a package is installed, Ubuntu copies its executable and other configuration files to the proper directories. But when you remove any unneeded package, then usually the system only removes the executable but does not remove the configuration files associated with the package being removed. With the passage of time, these files can become one big mess and cause the wastage of disk space as well.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you through the step by step installation completely remove package on Ubuntu on Ubuntu systems.

Completely Remove Package on Ubuntu

You will remove the binaries, but not the configuration or data files of the package package-name. It will also leave dependencies installed with it on installation time untouched.

apt-get remove packagename

You will remove about everything regarding the package name, but not the dependencies installed with it on installation. Both commands are equivalent. Particularly useful when you want to ‘start all over’ with an application because you messed up the configuration. However, it does not remove configuration or data files residing in users home directories, usually in hidden folders there. There is no easy way to get those removed as well.

apt-get purge packagename
apt-get remove --purge packagename

Removes orphaned packages i.e. installed packages that used to be installed as a dependency, but aren’t any longer. Use this after removing a package which had installed dependencies you’re no longer interested in.

apt-get autoremove

You will attempt to remove then not used dependencies anymore in one step.

aptitude remove packagename
aptitude purge packagename

Congratulations! You have successfully completely deleted the package. Thanks for using this tutorial for completely remove package on Ubuntu system. For additional help or useful information, we recommend you to check the official Ubuntu website.