Recipe 3.11. Finding Out What Is Installed on a Debian System

 < Day Day Up > 

3.11.1 Problem

You want to know what packages are on your system, what packages files belong to, and what's in individual packages.

3.11.2 Solution

Use the querying features of dpkg.

To list all installed packages and pipe the list to a file, use:

$ dpkg -l | tee dpkglist

To find all packages related to your search term and show their installation status, use:

$ dpkg -l '*gnome*' Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name             Version          Description +++-=  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  pn  gnome   <none>    (no description available) un  gnome-about   <none>       (no description available)) ii  gnome-applets   2.4.2-1    Various applets for GNOME 2 panel rc  gnome-bin     1.4.2-18      Miscellaneous binaries used by GNOME

To find only installed packages related to your search term, use:

$ dpkg -l | grep gnome

To list files belonging to a package, use:

$ dpkg -L gnome-applets . /usr /usr/share /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/gnome-applets ...

To see what package a file belongs to, use:

$ dpkg -S boing.wav tuxkart-data: /usr/share/games/tuxkart/wavs/boing.wav

To show complete package information, use:

$ dpkg -s kpoker Package: kpoker Status: install ok installed Priority: optional Section: games Installed-Size: 428 Maintainer: Daniel Schepler <schepler@debian.org> Source: kdegames Version: 4:3.1.5-1 ....

3.11.3 Discussion

The table displayed by dpkg -l is a bit cryptic, so here's a translation. Believe it or not, it's ASCII art.

$ dpkg -l gnome* Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name             Version          Description +++-=  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  pn  gnome   <none>    (no description available) un  gnome-about   <none>       (no description available)) ii  gnome-applets   2.4.2-1    Various applets for GNOME 2 panel rc  gnome-bin     1.4.2-18      Miscellaneous binaries used by GNOME

On the pn gnome line, follow the p upward; there are three "arrows" pointing to Desired=Unknown/Install/Remove/Purge/Hold. This represents the state you wish the package to have (in this case, "purge").

The next column, n, points to the Status line, where we are informed that it is "Not/Installed."

The third column points to the error and is empty (a good thing). As the end of this line indicates, anything in the Status or Err columns in uppercase is really bad.

So, package gnome was installed once upon a time, but I desired it purged, and so it was.

un means a package has never been installed.

ii means a package is desired and installed.

rc means a package was once installed but then was removed, leaving the configuration files behind. This is easy to check:

$ dpkg -L gnome-bin /etc/logcheck/ignore.d.server/gnome-bin /etc/logcheck/ignore.d.workstation/gnome-bin

3.11.4 See Also

  • dpkg(8)

     < Day Day Up > 


    Linux Cookbook
    Linux Cookbook
    ISBN: 0596006403
    EAN: 2147483647
    Year: 2004
    Pages: 434

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net