Content-type: text/html Man page of dpkg-query

dpkg-query

Section: dpkg suite (1)
Updated: 2008-08-18
Index Return to Main Contents
 

NAME

dpkg-query - a tool to query the dpkg database  

SYNOPSIS

dpkg-query [option...] command  

DESCRIPTION

dpkg-query is a tool to show information about packages listed in the dpkg database.  

COMMANDS

-l, --list package-name-pattern...
List packages matching given pattern. If no package-name-pattern is given, list all packages in /var/lib/dpkg/status, excluding the ones marked as not-installed (i.e. those which have been previously purged). Normal shell wildchars are allowed in package-name-pattern. Please note you will probably have to quote package-name-pattern to prevent the shell from performing filename expansion. For example this will list all package names starting with ``libc6'':

  dpkg-query -l 'libc6*'

The output format of this option is not configurable, but varies automatically to fit the terminal width. It is intended for human readers, and is not easily machine-readable. See -W (--show) and --showformat for a way to configure the output format.

-W, --show package-name-pattern...
Just like the --list option this will list all packages matching the given pattern. However the output can be customized using the --showformat option. The default output format gives one line per matching package, each line having the name and installed version of the package, separated by a tab.
-s, --status package-name...
Report status of specified package. This just displays the entry in the installed package status database.
-L, --listfiles package-name...
List files installed to your system from package-name. However, note that files created by package-specific installation-scripts are not listed.
-S, --search filename-search-pattern...
Search for a filename from installed packages. All standard shell wildchars can be used in the pattern. This command will not list extra files created by maintainer scripts, nor will it list alternatives.
-p, --print-avail package-name...
Display details about package-name, as found in /var/lib/dpkg/available. Users of APT-based frontends should use apt-cache show package-name instead as the available file is only kept up-to-date when using dselect.
-h, --help
Show the usage message and exit.
--version
Show the version and exit.
--license, --licence
Show the copyright licensing terms and exit.
 

OPTIONS

--admindir=dir
Change the location of the dpkg database. The default location is /var/lib/dpkg.
-f, --showformat=format
This option is used to specify the format of the output --show will produce. The format is a string that will be output for each package listed.

In the format string, "\" introduces escapes:

    \n  newline
    \r  carriage return
    \t  tab

"\" before any other character suppresses any special meaning of the following character, which is useful for "\" and "$".

Package information can be included by inserting variable references to package fields using the syntax "${field[;width]}". Fields are printed right-aligned unless the width is negative in which case left alignment will be used. The following fields are recognised but they are not necessarily available in the status file (only internal fields or fields stored in the binary package end up in it):

    Architecture
    Bugs
    Conffiles (internal)
    Config-Version (internal)
    Conflicts
    Breaks
    Depends
    Description
    Enhances
    Essential
    Filename (internal, dselect related)
    Homepage
    Installed-Size
    MD5sum (internal, dselect related)
    MSDOS-Filename (internal, dselect related)
    Maintainer
    Origin
    Package
    Pre-Depends
    Priority
    Provides
    Recommends
    Replaces
    Revision (obsolete)
    Section
    Size (internal, dselect related)
    Source
    Status (internal)
    Suggests
    Tag (usually not in the .deb but in APT's Packages files)
    Triggers-Awaited (internal)
    Triggers-Pending (internal)
    Version

The default format string is "${Package}\t${Version}\n". Actually, all other fields found in the status file (i.e. user defined fields) can be requested, too. They will be printed as-is, though, no conversion nor error checking is done on them. To get the name of the dpkg maintainer and the installed version, you could run:

  dpkg-query -W -f='${Package} ${Version}\t${Maintainer}\n' dpkg
 

ENVIRONMENT

COLUMNS
This setting influences the output of the --list option by changing the width of its output.
 

AUTHOR

Copyright © 2001 Wichert Akkerman

This is free software; see the GNU General Public Licence version 2 or later for copying conditions. There is NO WARRANTY.  

SEE ALSO

dpkg(1).


 

Index

NAME
SYNOPSIS
DESCRIPTION
COMMANDS
OPTIONS
ENVIRONMENT
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 03:41:10 GMT, September 24, 2010