426 CHAPTER 29 (Business web hosting) INSTALLING SOFTWARE Uninstalling Packages
426 CHAPTER 29 INSTALLING SOFTWARE Uninstalling Packages To remove a package, type the following: sudo dpkg -r packagename Note that you simply need to type the name of the program, without its version number or the .i386.deb file extensions. In this case, dpkg is slightly better behaved than when installing software. If there any reverse dependencies (other packages that depend on the one you re trying to remove), you ll be stopped in your tracks with a couple of error messages. You ll need to resolve the reverse dependencies first but, of course, they might also have their own reverse dependencies . . . Welcome back to dependency hell! Note The dpkg -r command will remove the package but leave behind its configuration files. This is handy if you install the software again in future. In order to remove the configuration files in addition to the software, type sudo dpkg -P packagename. Querying Packages dpkg includes a couple of query facilities that display details about packages. You can find out if a package is installed by typing this: dpkg -l packagename If you want to find out every bit of information about an installed package, including what dependencies it has, use the following command: dpkg -s packagename |less This example pipes the output of dpkg into lessso you can read it more easily, because it s likely to fill several terminal window screens. You can also use dpkg to query an installation file you ve just downloaded: dpkg -I packagename.i386.deb |less All said, dpkg is an often undervalued tool that s capable of some handy low-level package- management tasks. Take a look at its man page to learn more. Using the APT Tools dpkg is the only option if you want to install a package file you ve just downloaded. However, if you wish to use software repositories, you ll need to use the APT tools. These still use dpkg in the background to install and remove packages, but they also feature intelligence to handle dependency management.