In this tutorial, we will show you how to completely remove packages on Ubuntu Linux. 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 a waste 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 the step-by-step installation completely removes packages on Ubuntu on Ubuntu systems.
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 that had installed dependencies you’re no longer interested in.
You will attempt to remove the not used dependencies anymore in one step.
aptitude remove packagename aptitude purge packagename
Removing a package on Ubuntu is a simple process, but sometimes you may want to remove a package and all of its associated configuration files and dependencies. This is known as purging a package. We’ve explained the difference between the standard “remove” command and the “purge” command and how they can be used to achieve different results.
First, we’ve discussed the standard “remove” command, which is used to remove a package from the system. This command will remove the package itself but will leave behind any configuration files or dependencies that were installed with the package. This can be useful if you want to keep the configuration files for a package, but no longer need the package itself.
Next, we’ve discussed the “purge” command, which is used to completely remove a package and all of its associated configuration files and dependencies. This command is useful if you want to completely remove a package and all of its associated files and dependencies, leaving no trace of the package on the system.
Overall, removing packages from Ubuntu is a straightforward process, but understanding the difference between the “remove” and “purge” commands can be useful when you want to completely remove a package and all of its associated files and dependencies. We hope you found this guide helpful and that it will be useful for you in the future. For additional help or useful information, we recommend you check the official Ubuntu website.