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 causes 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 completely remove package is quite simple. I will show you through the step by step completely remove package with apt-get on Ubuntu.
Completely Remove Package on Ubuntu
You will remove the binaries, but not the configuration or data files of the package packagename. It will also leave dependencies installed with it on installation time untouched.
apt-get remove packagename
You will remove about everything regarding the package packagename, 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 an dependency, but aren’t any longer. Use this after removing a package which had installed dependencies you’re no longer interested in.
You will attempt to remove then not used dependencies anymore in one step.
aptitude remove packagename
aptitude purge packagename