Monday, 4 November 2013

Uninstalling Linux Packages

Advanced Package Tool (Apt) is one of the programmes that make Linux such an awesome operating system.  It allows you to install any of 1000s of libraries, commands, tools and applications and Sourceforge have a good introduction for this.  However there is little info about how to uninstall anything and clean up properly. Vast amounts of hard-drive space can be taken up by files left over after an uninstall.  This post gives you the information to thoroughly uninstall programmes and any extra dependencies that came with them. Keep your Linux machine as clean as Mr. Clean!

You can install packages with:
apt-get install <package name>
So, the obvious assumption is to use the 'apt uninstall' command to uninstall a package. However this can leave some traces behind such as configuration files and other packages required solely by the package being uninstalled (aka dependencies).  I found the following commands invaluable for uninstalling packages.

To list the packages you have installed:
dpkg -l

To uninstall a package (tab auto-complete work with package names) and all its dependencies
sudo apt-get autoremove --purge <package_name>


To clean up install files, which can become quite a significant chunk of drive space.
sudo apt-get clean



No comments:

Post a Comment