dpkg

dpkg

To list all packages installed on the system, from a terminal prompt enter:

  • dpkg -l

Depending on the amount of packages on your system, this can generate a large amount of output. Pipe the output through grep to see if a specific package is installed:

  • dpkg -l | grep apache2

 

To list the files installed by a package, in this case the ufw package, enter:

  • dpkg -L ufw

If you are not sure which package installed a file, dpkg -S may be able to tell you. For example:

  • dpkg -S /etc/host.conf
  • base-files: /etc/host.conf

The output shows that the /etc/host.conf belongs to the base-files package.

 

 

Many files are automatically generated during the package install process, and even though they are on the filesystem dpkg -S may not know which package they belong to.

You can install a local .deb file by entering:

  • sudo dpkg -i zip_3.0-4_i386.deb

Uninstalling a package can be accomplished by:

  • sudo dpkg -r zip
 

 

Uninstalling packages using dpkg, in most cases, is NOT recommended. It is better to use a package manager that handles dependencies, to ensure that the system is in a consistent state. For example using dpkg -r you can remove the zip package, but any packages that depend on it will still be installed and may no longer function correctly.

For more dpkg options see the man page: man dpkg.

 

posted @ 2012-03-15 15:35  nalasun  阅读(287)  评论(0编辑  收藏  举报