How to uninstall packages with apt

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

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.


Entry filed under: Uncategorized. Tags: , , , .

Svn history bash script XRefactory

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed

January 2008
« Dec   Feb »

%d bloggers like this: