Posts tagged ‘removing packages’

How to uninstall packages with apt

Decorative PictureInstalling packages with apt is generally very easy. Uninstalling (or removing) packages can be slightly more annoying.

The standard command for removing packages with apt is

apt-get remove <package-name>

This should always work as long as

  • The package doesn’t have dependencies
  • The commands needed to remove the package execute correctly.

Note that this leaves all the configuration files in place – so that if you decide to reinstall the packages again at a later date they should be configured exactly as before.

If you want to remove these configuration files for some reason (for example if you’ve completely destroyed them by your editting) then you purge the package instead with:

apt-get --purge remove <package-name>

Things that can go wrong

You don’t know the name of the package

This can be more of a probably than one might at first envisage – and it is definitely annoying when it happens. To find the package name you can use apt-cache, a command for returning information from the local cache of all available packages.

apt-cache search <keyword regex>

searches for all packages in the repository that contain the regular expression in their name of description and returns a list. Performing

apt-cache search <word> | less

and then searching for other relevant words using “/<other-word>” can be a very effective way of finding package names.

If you are getting too many results you might like to try

apt-cache --names-only search <keyword>

which will only search the package name and not the description.


January 28, 2008 at 12:17 pm Leave a comment

June 2019
« Nov