Datasheet

78
Part I The Fundamentals
Listing installed packages
Listing installed packages is a pretty easy task, and you can use either dpkg or
aptitude to do it.
Using dpkg to list packages
dpkg has a listing mode that doesn’t affect the packaging system databases, so it’s
safe to use on a regular basis. It can be the most convenient way to quickly see
whether a package is installed, as you can see with the following shell session:
user@hostname:~$ dpkg –l dpkg
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err=(none)/Hold/Reinst-required/X=both(Status,Err:uppercase=bad)
||/ Name Version Description
+++-==============-==============-=========================================
ii dpkg 1.9.21 Package maintenance system for Debian
user@hostname:~$
dpkg’s -l option turns on listing mode, and you can supply it with a list of argu-
ments or none at all. If you provide no arguments,
dpkg will list all the packages
that have records in the database. If you provide it with a list of arguments,
dpkg
will interpret it as a list of package names. In our example, we asked dpkg to list its
own information.
dpkg also supports the use of wildcards, as discussed in Chapter
3, to allow you to easily list a set of related packages, as in this example:
user@hostname:~$ dpkg –l “base*”
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both(Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-=========================================
un base <none> (no description available)
ii base-config 1.33.18 Debian base configuration package
ii base-files 3.0.2 Debian base system miscellaneous files
ii base-passwd 3.4.1 Debian Base System Password/Group Files
user@hostname:~$
Note the double-quotes surrounding base*. Without the quotes, your shell will inter-
pret the wildcards itself, which might produce unexpected results. The last three
fields in the output, Name, Version, and Description, should be self-explanatory. The
first field, however, could use a closer examination.
Those two letters in the first field indicate the state the package should be in, and
the state the package is actually in. Even though Debian goes to great lengths to
ensure easy package management, bugs do occasionally creep in and interrupt a
package installation or removal halfway through. Likewise, if your computer were
09_576445 ch04.qxd 7/5/05 3:10 PM Page 78