blob: 8ddf7eacf55ae930674b814a9148476c19901540 [file] [log] [blame]
.TH dpkg\-query 1 "2011-08-14" "Debian Project" "dpkg suite"
.SH NAME
dpkg\-query \- a tool to query the dpkg database
.
.SH SYNOPSIS
.B dpkg\-query
.RI [ option "...] " command
.
.SH DESCRIPTION
\fBdpkg\-query\fP is a tool to show information about packages listed in
the \fBdpkg\fP database.
.
.SH COMMANDS
.TP
.BR \-l ", " \-\-list " [\fIpackage-name-pattern\fP...]"
List packages matching given pattern. If no \fIpackage-name-pattern\fP
is given, list all packages in \fI/var/lib/dpkg/status\fP, excluding
the ones marked as not-installed (i.e. those which have been previously
purged). Normal shell wildchars are allowed
in \fIpackage-name-pattern\fP. Please note you will probably have to
quote \fIpackage-name-pattern\fP to prevent the shell from performing
filename expansion. For example this will list all package names starting
with \*(lqlibc6\*(rq:
.nf
\fBdpkg\-query \-l \(aqlibc6*\(aq\fP
.fi
The first three columns of the output show the desired action, the package
status, and errors, in that order.
Desired action:
.nf
u = Unknown
i = Install
h = Hold
r = Remove
p = Purge
.fi
Package status:
.nf
n = Not-installed
c = Config-files
H = Half-installed
U = Unpacked
F = Half-configured
W = Triggers-awaiting
t = Triggers-pending
i = Installed
.fi
Error flags:
.nf
<empty> = (none)
R = Reinst-required
.fi
An uppercase status or error letter indicates the package is likely to
cause severe problems. Please refer to \fBdpkg\fP(1) for information
about the above states and flags.
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 \fB\-W\fP (\fB\-\-show\fP)
and \fB\-\-showformat\fP for a way to configure the output format.
.TP
.BR \-W ", " \-\-show " [\fIpackage-name-pattern\fP...]"
Just like the \fB\-\-list\fP option this will list all packages matching
the given pattern. However the output can be customized using the
\fB\-\-showformat\fP 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.
.TP
.BR \-s ", " \-\-status " \fIpackage-name\fP..."
Report status of specified package. This just displays the entry in
the installed package status database. When multiple \fIpackage-name\fP
are listed, the requested status entries are separated by an empty line.
.TP
.BR \-L ", " \-\-listfiles " \fIpackage-name\fP..."
List files installed to your system from \fIpackage-name\fP. When multiple
\fIpackage-name\fP are listed, the requested lists of files are separated
by an empty line. However, note that files created by package-specific
installation-scripts are not listed.
.TP
.BR \-c ", " \-\-control\-path " \fIpackage-name\fP [\fIcontrol-file\fP]"
List paths for control files installed to your system from \fIpackage-name\fP.
If \fIcontrol-file\fP is specified then only list the path for that control
file if it is present. \fBWarning\fP: this command is semi-public, it should
be used only as a last resort solution, and if no other interface is
available. It might get deprecated later on if better interfaces or the
current architectural deficiencies have been solved.
.TP
.BR \-S ", " \-\-search " \fIfilename-search-pattern\fP..."
Search for packages that own files corresponding to the given pattern.
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.
.TP
.BR \-p ", " \-\-print\-avail " \fIpackage-name\fP..."
Display details about \fIpackage-name\fP, as found in
\fI/var/lib/dpkg/available\fP. When multiple \fIpackage-name\fP are
listed, the requested \fIavailable\fP entries are separated by an empty
line.
Users of APT-based frontends
should use \fBapt\-cache show\fP \fIpackage-name\fP instead
as the \fIavailable\fP file is only kept up-to-date when
using \fBdselect\fP.
.TP
.BR \-h ", " \-\-help
Show the usage message and exit.
.TP
.B \-\-version
Show the version and exit.
.
.SH OPTIONS
.TP
.BI \-\-admindir= dir
Change the location of the \fBdpkg\fR database. The default location is
\fI/var/lib/dpkg\fP.
.TP
.BR \-f ", " \-\-showformat=\fIformat\fR
This option is used to specify the format of the output \fB\-\-show\fP
will produce. The format is a string that will be output for each package
listed.
In the format string, \(lq\fB\e\fP\(rq introduces escapes:
.nf
\fB\en\fP newline
\fB\er\fP carriage return
\fB\et\fP tab
.fi
\(lq\fB\e\fP\(rq before any other character suppresses any special
meaning of the following character, which is useful for \(lq\fB\e\fP\(rq
and \(lq\fB$\fP\(rq.
Package information can be included by inserting
variable references to package fields using the syntax
\(lq\fB${\fP\fIfield\fR[\fB;\fP\fIwidth\fR]\fB}\fP\(rq. Fields are
printed right-aligned unless the width is negative in which case left
alignment will be used. The following \fIfield\fRs 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):
.nf
\fBArchitecture\fP
\fBBugs\fP
\fBConffiles\fP (internal)
\fBConfig\-Version\fP (internal)
\fBConflicts\fP
\fBBreaks\fP
\fBDepends\fP
\fBDescription\fP
\fBEnhances\fP
\fBEssential\fP
\fBFilename\fP (internal, front-end related)
\fBHomepage\fP
\fBInstalled\-Size\fP
\fBMD5sum\fP (internal, front-end related)
\fBMSDOS\-Filename\fP (internal, front-end related)
\fBMaintainer\fP
\fBOrigin\fP
\fBPackage\fP
\fBPre\-Depends\fP
\fBPriority\fP
\fBProvides\fP
\fBRecommends\fP
\fBReplaces\fP
\fBRevision\fP (obsolete)
\fBSection\fP
\fBSize\fP (internal, front-end related)
\fBSource\fP
\fBStatus\fP (internal)
\fBSuggests\fP
\fBTag\fP (usually not in the .deb but in the repository Packages files)
\fBTriggers\-Awaited\fP (internal)
\fBTriggers\-Pending\fP (internal)
\fBVersion\fP
.fi
The default format string is \(lq\fB${Package}\et${Version}\en\fP\(rq.
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:
.nf
\fBdpkg\-query \-W \-f=\(aq${Package} ${Version}\\t${Maintainer}\\n\(aq dpkg\fP
.fi
.
.SH "EXIT STATUS"
.TP
.B 0
The requested query was successfully performed.
.TP
.B 1
Problems were encountered while parsing the command line or performing the
query, including no file or package being found (except for \-\-control\-path).
.
.SH ENVIRONMENT
.TP
.B DPKG_ADMINDIR
If set and the \fB\-\-admindir\fP option has not been specified, it will
be used as the dpkg data directory.
.TP
\fBCOLUMNS\fP
This setting influences the output of the \fB\-\-list\fP option by changing
the width of its output.
.
.SH AUTHOR
Copyright \(co 2001 Wichert Akkerman
.sp
This is free software; see the GNU General Public Licence version 2 or
later for copying conditions. There is NO WARRANTY.
.
.SH SEE ALSO
.BR dpkg (1).