Understanding the dpkg Utility

The Debian package tool that's most similar to the rpm utility is dpkg. This tool's syntax is similar to that of rpm:

dpkg [options] action [package-filename\package-name]

Tables 11.3 and 11.4 summarize the dpkg actions (equivalent to the rpm operation) and options, respectively. Most of these actions and options are similar to their rpm counterparts, but there are some exceptions. For instance, there is no separate upgrade action in dpkg; the install action will also upgrade a package.

Table 11.3: dpkg Primary Actions

dpkg Action


-i or—install

Installs a package.


Reconfigures an installed package: Runs the post-installation script to set site-specific options.

-ror-P or-remove or-purge

Removes a package. The -P or-purge action does a more complete job; it removes configuration files that -rand-remove don't delete.

-p or-print-avail

Displays information about a package.

dpkg Action


-1 pattern or-list pattern

Lists all installed packages whose names match pattern.

-L or—listfiles

Lists the installed files associated with a package.

-C or-audit

Searches for partially installed packages and suggests what to do with them.

Table 11.4: Options to Fine-Tune dpkg Actions

dpkg Option

Used with Actions


-root =dir


Modifies the Linux system using a root directory located at dir. Can be used to maintain one Linux installation discrete from another one, say during OS installation or emergency maintenance.

-B or-auto-deconfigure


Disables packages that rely on one being removed.



Forces specific actions to be taken. Consult the dpkg man page for details of things this option does.



Ignores dependency information for the specified package.



Checks for dependencies, conflicts, and other problems without actually installing the package.



Installs all packages matching the package name wildcard in the specified directory and all subdirectories.



Doesn't install the package if a newer version of the same package is already installed.

-E or-skip-same-version


Doesn't install the package if the same version of the package is already installed.

Debian packages are named similarly to RPMs—the format is packagename_version-revision.6eb, as in manydep_2.31-6.deb. An architecture code is sometimes added before the .deb extension, and the revision code is sometimes omitted.

Few independent sites carry Debian packages; the Debian site itself is the primary source of packages for this distribution. Check http://www.debian.org/distrib/packages for a search tool to locate packages by name. A few commercial distributions, such as Libranet (http://www.libranet.com) and Xandros (http://www.xandros.com), are built from Debian. In my experience, cross-distribution package compatibility is very good within this Debian family—much better than between RPM-based distributions.

0 0

Post a comment