man-pages/man1/dpkg-query.1.html
2021-03-31 01:06:50 +01:00

453 lines
14 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of dpkg-query</TITLE>
</HEAD><BODY>
<H1>dpkg-query</H1>
Section: dpkg suite (1)<BR>Updated: 2020-03-23<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
dpkg-query - a tool to query the dpkg database
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>dpkg-query</B>
[<I>option</I>...] <I>command</I>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>dpkg-query</B> is a tool to show information about packages listed in
the <B>dpkg</B> database.
<A NAME="lbAE">&nbsp;</A>
<H2>COMMANDS</H2>
<DL COMPACT>
<DT id="1"><B>-l</B>, <B>--list</B> [<I>package-name-pattern</I>...]
<DD>
List all known packages matching one or more patterns, regardless of their
status, which includes any real or virtual package referenced in any
dependency relationship field (such as <B>Breaks</B>, <B>Enhances</B>, etc.).
If no <I>package-name-pattern</I> is given, list all packages in
<I>/var/lib/dpkg/status</I>, excluding the ones marked as not-installed (i.e.
those which have been previously purged).
Normal shell wildcard characters are allowed in <I>package-name-pattern</I>.
Please note you will probably have to quote <I>package-name-pattern</I> to
prevent the shell from performing filename expansion.
For example this will list all package names starting with ``libc6'':
<P>
<PRE>
<B>dpkg-query -l 'libc6*'</B>
</PRE>
<P>
The first three columns of the output show the desired action, the package
status, and errors, in that order.
<P>
Desired action:
<PRE>
u = Unknown
i = Install
h = Hold
r = Remove
p = Purge
</PRE>
<P>
Package status:
<PRE>
n = Not-installed
c = Config-files
H = Half-installed
U = Unpacked
F = Half-configured
W = Triggers-awaiting
t = Triggers-pending
i = Installed
</PRE>
<P>
Error flags:
<PRE>
&lt;empty&gt; = (none)
R = Reinst-required
</PRE>
<P>
An uppercase status or error letter indicates the package is likely to
cause severe problems. Please refer to <B><A HREF="/cgi-bin/man/man2html?1+dpkg">dpkg</A></B>(1) for information
about the above states and flags.
<P>
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 <B>-W</B> (<B>--show</B>)
and <B>--showformat</B> for a way to configure the output format.
<DT id="2"><B>-W</B>, <B>--show</B> [<I>package-name-pattern</I>...]
<DD>
Just like the <B>--list</B> option this will list all packages matching
the given pattern. However the output can be customized using the
<B>--showformat</B> option.
The default output format gives one line per matching package, each line
having the name (extended with the architecture qualifier for
<B>Multi-Arch</B> <B>same</B> packages) and installed version of the package,
separated by a tab.
<DT id="3"><B>-s</B>, <B>--status</B> [<I>package-name</I>...]
<DD>
Report status of specified package. This just displays the entry in
the installed package status database.
If no <I>package-name</I> is specified it will display all package entries
in the status database (since dpkg 1.19.1).
When multiple <I>package-name</I> entries are listed, the requested status
entries are separated by an empty line, with the same order as specified
on the argument list.
<DT id="4"><B>-L</B>, <B>--listfiles</B> <I>package-name</I>...
<DD>
List files installed to your system from <I>package-name</I>. When multiple
<I>package-name</I> are listed, the requested lists of files are separated
by an empty line, with the same order as specified on the argument list.
However, note that files created by package-specific installation-scripts
are not listed.
<DT id="5"><B>--control-list</B> <I>package-name</I>
<DD>
List control files installed to your system from <I>package-name</I>
(since dpkg 1.16.5).
These can be used as input arguments to <B>--control-show</B>.
<DT id="6"><B>--control-show</B> <I>package-name</I> <I>control-file</I>
<DD>
Print the <I>control-file</I> installed to your system from <I>package-name</I>
to the standard output (since dpkg 1.16.5).
<DT id="7"><B>-c</B>, <B>--control-path</B> <I>package-name</I> [<I>control-file</I>]
<DD>
List paths for control files installed to your system from <I>package-name</I>
(since dpkg 1.15.4).
If <I>control-file</I> is specified then only list the path for that control
file if it is present.
<P>
<B>Warning</B>: this command is deprecated as it gives direct access to the
internal dpkg database, please switch to use <B>--control-list</B> and
<B>--control-show</B> instead for all cases where those commands might
give the same end result. Although, as long as there is still at least
one case where this command is needed (i.e. when having to remove a
damaging postrm maintainer script), and while there is no good solution
for that, this command will not get removed.
<DT id="8"><B>-S</B>, <B>--search</B> <I>filename-search-pattern</I>...
<DD>
Search for packages that own files corresponding to the given pattern.
Standard shell wildcard characters can be used in the pattern, where
asterisk (<B>*</B>) and question mark (<B>?</B>) will match a slash,
and backslash (<B>\</B>) will be used as an escape character.
<P>
If the first character in the <I>filename-search-pattern</I> is none of
'<B>*[?/</B>' then it will be considered a substring match and will be
implicitly surrounded by '<B>*</B>' (as in
<B>*</B><I>filename-search-pattern</I><B>*</B>).
If the subsequent string contains any of '<B>*[?\</B>', then it will
handled like a glob pattern, otherwise any trailing '<B>/</B>' or
'<B>/.</B>' will be removed and a literal path lookup will be performed.
<P>
This command will not list extra files created by maintainer scripts,
nor will it list alternatives.
<DT id="9"><B>-p</B>, <B>--print-avail</B> [<I>package-name</I>...]
<DD>
Display details about packages, as found in <I>/var/lib/dpkg/available</I>.
If no <I>package-name</I> is specified, it will display all package entries
in the <I>available</I> database (since dpkg 1.19.1).
When multiple <I>package-name</I> are listed, the requested <I>available</I>
entries are separated by an empty line, with the same order as specified
on the argument list.
<P>
Users of APT-based frontends
should use <B>apt-cache show</B> <I>package-name</I> instead
as the <I>available</I> file is only kept up-to-date when
using <B>dselect</B>.
<DT id="10"><B>-?</B>, <B>--help</B>
<DD>
Show the usage message and exit.
<DT id="11"><B>--version</B>
<DD>
Show the version and exit.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="12"><B>--admindir=</B><I>dir</I>
<DD>
Change the location of the <B>dpkg</B> database. The default location is
<I>/var/lib/dpkg</I>.
<DT id="13"><B>--load-avail</B>
<DD>
Also load the available file when using the <B>--show</B> and <B>--list</B>
commands, which now default to only querying the status file
(since dpkg 1.16.2).
<DT id="14"><B>--no-pager</B>
<DD>
Disables the use of any pager when showing information (since dpkg 1.19.2).
<DT id="15"><B>-f</B>, <B>--showformat=</B><I>format</I>
<DD>
This option is used to specify the format of the output <B>--show</B>
will produce (short option since dpkg 1.13.1).
The format is a string that will be output for each package listed.
<P>
In the format string, "<B>\</B>" introduces escapes:
<P>
<PRE>
<B>\n</B> newline
<B>\r</B> carriage return
<B>\t</B> tab
</PRE>
<P>
"<B>\</B>" before any other character suppresses any special
meaning of the following character, which is useful for "<B>\</B>"
and "<B>$</B>".
<P>
Package information can be included by inserting
variable references to package fields using the syntax
"<B>${</B><I>field</I>[<B>;</B><I>width</I>]<B>}</B>". Fields are
printed right-aligned unless the width is negative in which case left
alignment will be used. The following <I>field</I>s are recognized but
they are not necessarily available in the status file (only internal
fields or fields stored in the binary package end up in it):
<P>
<PRE>
<B>Architecture</B>
<B>Bugs</B>
<B>Conffiles</B> (internal)
<B>Config-Version</B> (internal)
<B>Conflicts</B>
<B>Breaks</B>
<B>Depends</B>
<B>Description</B>
<B>Enhances</B>
<B>Essential</B>
<B>Filename</B> (internal, front-end related)
<B>Homepage</B>
<B>Installed-Size</B>
<B>MD5sum</B> (internal, front-end related)
<B>MSDOS-Filename</B> (internal, front-end related)
<B>Maintainer</B>
<B>Origin</B>
<B>Package</B>
<B>Pre-Depends</B>
<B>Priority</B>
<B>Provides</B>
<B>Recommends</B>
<B>Replaces</B>
<B>Revision</B> (obsolete)
<B>Section</B>
<B>Size</B> (internal, front-end related)
<B>Source</B>
<B>Status</B> (internal)
<B>Suggests</B>
<B>Tag</B> (usually not in .deb but in repository Packages files)
<B>Triggers-Awaited</B> (internal)
<B>Triggers-Pending</B> (internal)
<B>Version</B>
</PRE>
<P>
The following are virtual fields, generated by <B>dpkg-query</B> from
values from other fields (note that these do not use valid names for
fields in control files):
<DL COMPACT><DT id="16"><DD>
<DL COMPACT>
<DT id="17"><B>binary:Package</B>
<DD>
It contains the binary package name with a possible architecture qualifier
like "libc6:amd64" (since dpkg 1.16.2).
An architecture qualifier will be present to make the package name unambiguous,
for example if the package has a <B>Multi-Arch</B> field with a value of
<B>same</B> or the package is of a foreign architecture.
<DT id="18"><B>binary:Synopsis</B>
<DD>
It contains the package short description (since dpkg 1.19.1).
<DT id="19"><B>binary:Summary</B>
<DD>
This is an alias for <B>binary:Synopsis</B> (since dpkg 1.16.2).
<DT id="20"><B>db:Status-Abbrev</B>
<DD>
It contains the abbreviated package status (as three characters),
such as "ii " or "iHR" (since dpkg 1.16.2).
See the <B>--list</B> command description for more details.
<DT id="21"><B>db:Status-Want</B>
<DD>
It contains the package wanted status, part of the Status field
(since dpkg 1.17.11).
<DT id="22"><B>db:Status-Status</B>
<DD>
It contains the package status word, part of the Status field
(since dpkg 1.17.11).
<DT id="23"><B>db:Status-Eflag</B>
<DD>
It contains the package status error flag, part of the Status field
(since dpkg 1.17.11).
<DT id="24"><B>db-fsys:Files</B>
<DD>
It contains the list of the package filesystem entries separated by newlines
(since dpkg 1.19.3).
<DT id="25"><B>db-fsys:Last-Modified</B>
<DD>
It contains the timestamp in seconds of the last time the package filesystem
entries were modified (since dpkg 1.19.3).
<DT id="26"><B>source:Package</B>
<DD>
It contains the source package name for this binary package
(since dpkg 1.16.2).
<DT id="27"><B>source:Version</B>
<DD>
It contains the source package version for this binary package
(since dpkg 1.16.2)
<DT id="28"><B>source:Upstream-Version</B>
<DD>
It contains the source package upstream version for this binary package
(since dpkg 1.18.16)
</DL>
</DL>
<DT id="29"><DD>
The default format string is "<B>${binary:Package}\t${Version}\n</B>".
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
<B>dpkg</B> maintainer and the installed version, you could run:
<P>
<PRE>
<B>dpkg-query -W -f='${binary:Package} ${Version}\t${Maintainer}\n' dpkg</B>
</PRE>
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>EXIT STATUS</H2>
<DL COMPACT>
<DT id="30"><B>0</B>
<DD>
The requested query was successfully performed.
<DT id="31"><B>1</B>
<DD>
The requested query failed either fully or partially, due to no file or
package being found (except for <B>--control-path</B>,
<B>--control-list</B> and <B>--control-show</B> were such errors are
fatal).
<DT id="32"><B>2</B>
<DD>
Fatal or unrecoverable error due to invalid command-line usage, or
interactions with the system, such as accesses to the database,
memory allocations, etc.
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>ENVIRONMENT</H2>
<A NAME="lbAI">&nbsp;</A>
<H3>External environment</H3>
<DL COMPACT>
<DT id="33"><B>SHELL</B>
<DD>
Sets the program to execute when spawning a command via a shell
(since dpkg 1.19.2).
<DT id="34"><B>PAGER</B>
<DD>
<B>DPKG_PAGER</B>
Sets the pager command to use (since dpkg 1.19.1), which will be executed
with &laquo;<B>$SHELL -c</B>&raquo;.
If <B>SHELL</B> is not set, &laquo;<B>sh</B>&raquo; will be used instead.
The <B>DPKG_PAGER</B> overrides the <B>PAGER</B> environment variable
(since dpkg 1.19.2).
<DT id="35"><B>DPKG_ADMINDIR</B>
<DD>
If set and the <B>--admindir</B> option has not been specified, it will
be used as the <B>dpkg</B> data directory.
<DT id="36"><B>DPKG_COLORS</B>
<DD>
Sets the color mode (since dpkg 1.18.5).
The currently accepted values are: <B>auto</B> (default), <B>always</B> and
<B>never</B>.
</DL>
<A NAME="lbAJ">&nbsp;</A>
<H3>Internal environment</H3>
<DL COMPACT>
<DT id="37"><B>LESS</B>
<DD>
Defined by <B>dpkg-query</B> to "<B>-FRSXMQ</B>", if not already set, when
spawning a pager (since dpkg 1.19.2).
To change the default behavior, this variable can be preset to some other
value including an empty string, or the <B>PAGER</B> or <B>DPKG_PAGER</B>
variables can be set to disable specific options with &laquo;<B>-+</B>&raquo;, for
example <B>DPKG_PAGER=&quot;less -+F&quot;</B>.
</DL>
<A NAME="lbAK">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+dpkg">dpkg</A></B>(1).
<P>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="38"><A HREF="#lbAB">NAME</A><DD>
<DT id="39"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="40"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="41"><A HREF="#lbAE">COMMANDS</A><DD>
<DT id="42"><A HREF="#lbAF">OPTIONS</A><DD>
<DT id="43"><A HREF="#lbAG">EXIT STATUS</A><DD>
<DT id="44"><A HREF="#lbAH">ENVIRONMENT</A><DD>
<DL>
<DT id="45"><A HREF="#lbAI">External environment</A><DD>
<DT id="46"><A HREF="#lbAJ">Internal environment</A><DD>
</DL>
<DT id="47"><A HREF="#lbAK">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:11 GMT, March 31, 2021
</BODY>
</HTML>