1dpkg-query(1)                     dpkg suite                     dpkg-query(1)
2
3
4

NAME

6       dpkg-query - a tool to query the dpkg database
7

SYNOPSIS

9       dpkg-query [option...] command
10

DESCRIPTION

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

COMMANDS

16       -l, --list [package-name-pattern...]
17           List all known packages matching one or more patterns, regardless
18           of their status, which includes any real or virtual package
19           referenced in any dependency relationship field (such as Breaks,
20           Enhances, etc.).  If no package-name-pattern is given, list all
21           packages in /var/lib/dpkg/status, excluding the ones marked as not-
22           installed (i.e.  those which have been previously purged).  Normal
23           shell wildcard characters are allowed in package-name-pattern.
24           Please note you will probably have to quote package-name-pattern to
25           prevent the shell from performing filename expansion.  For example
26           this will list all package names starting with “libc6”:
27
28            dpkg-query -l 'libc6*'
29
30           The first three columns of the output show the desired action, the
31           package status, and errors, in that order.
32
33           Desired action:
34
35           u = Unknown
36           i = Install
37           h = Hold
38           r = Remove
39           p = Purge
40
41           Package status:
42
43           n = Not-installed
44           c = Config-files
45           H = Half-installed
46           U = Unpacked
47           F = Half-configured
48           W = Triggers-awaiting
49           t = Triggers-pending
50           i = Installed
51
52           Error flags:
53
54           <empty> = (none)
55           R = Reinst-required
56
57           An uppercase status or error letter indicates the package is likely
58           to cause severe problems. Please refer to dpkg(1) for information
59           about the above states and flags.
60
61           The output format of this option is not configurable, but varies
62           automatically to fit the terminal width. It is intended for human
63           readers, and is not easily machine-readable. See -W (--show) and
64           --showformat for a way to configure the output format.
65
66       -W, --show [package-name-pattern...]
67           Just like the --list option this will list all packages matching
68           the given patterns. However the output can be customized using the
69           --showformat option.  The default output format gives one line per
70           matching package, each line having the name (extended with the
71           architecture qualifier for Multi-Arch same packages) and installed
72           version of the package, separated by a tab.
73
74       -s, --status [package-name...]
75           Report status of specified packages. This just displays the entry
76           in the installed package status database.  If no package-name is
77           specified it will display all package entries in the status
78           database (since dpkg 1.19.1).  When multiple package-name entries
79           are listed, the requested status entries are separated by an empty
80           line, with the same order as specified on the argument list.
81
82       -L, --listfiles package-name...
83           List files installed to your system from package-name. When
84           multiple package-names are listed, the requested lists of files are
85           separated by an empty line, with the same order as specified on the
86           argument list.
87
88           Each file diversion is printed on its own line after its diverted
89           file, prefixed with one of the following localized strings:
90
91
92             locally diverted to: diverted-to
93             package diverts others to: diverted-to
94             diverted by pkg to: diverted-to
95
96           Hint: When machine parsing the output, it is customary to set the
97           locale to C.UTF-8 to get reproducible results.
98
99           This command will not list extra files created by maintainer
100           scripts, nor will it list alternatives.
101
102       --control-list package-name
103           List control files installed to your system from package-name
104           (since dpkg 1.16.5).  These can be used as input arguments to
105           --control-show.
106
107       --control-show package-name control-file
108           Print the control-file installed to your system from package-name
109           to the standard output (since dpkg 1.16.5).
110
111       -c, --control-path package-name [control-file]
112           List paths for control files installed to your system from package-
113           name (since dpkg 1.15.4).  If control-file is specified then only
114           list the path for that control file if it is present.
115
116           Warning: this command is deprecated as it gives direct access to
117           the internal dpkg database, please switch to use --control-list and
118           --control-show instead for all cases where those commands might
119           give the same end result. Although, as long as there is still at
120           least one case where this command is needed (i.e. when having to
121           remove a damaging postrm maintainer script), and while there is no
122           good solution for that, this command will not get removed.
123
124       -S, --search filename-search-pattern...
125           Search for packages that own files corresponding to the given
126           patterns.  Standard shell wildcard characters can be used in the
127           pattern, where asterisk (*) and question mark (?) will match a
128           slash, and backslash (\) will be used as an escape character.
129
130           If the first character in the filename-search-pattern is none of
131*[?/’ then it will be considered a substring match and will be
132           implicitly surrounded by ‘*’ (as in *filename-search-pattern*).  If
133           the subsequent string contains any of ‘*[?\’, then it will handled
134           like a glob pattern, otherwise any trailing ‘/’ or ‘/.’ will be
135           removed and a literal path lookup will be performed.
136
137           This command will not list extra files created by maintainer
138           scripts, nor will it list alternatives.
139
140           The output format consists of one line per matching pattern, with a
141           list of packages owning the pathname separated by a comma (U+002C
142,’) and a space (U+0020 ‘ ’), followed by a colon (U+003A ‘:’) and
143           a space, followed by the pathname. As in:
144
145             pkgname1, pkgname2: pathname1
146             pkgname3: pathname2
147
148           File diversions are printed with the following localized strings:
149
150
151             diversion by pkgname from: diverted-from
152             diversion by pkgname to: diverted-to
153
154           or for local diversions:
155
156
157             local diversion from: diverted-from
158             local diversion to: diverted-to
159
160           Hint: When machine parsing the output, it is customary to set the
161           locale to C.UTF-8 to get reproducible results.
162
163       -p, --print-avail [package-name...]
164           Display details about packages, as found in
165           /var/lib/dpkg/available.  If no package-name is specified, it will
166           display all package entries in the available database (since dpkg
167           1.19.1).  When multiple package-name are listed, the requested
168           available entries are separated by an empty line, with the same
169           order as specified on the argument list.
170
171           Users of APT-based frontends should use apt show package-name
172           instead as the available file is only kept up-to-date when using
173           dselect.
174
175       -?, --help
176           Show the usage message and exit.
177
178       --version
179           Show the version and exit.
180

OPTIONS

182       --admindir=dir
183           Change the location of the dpkg database. The default location is
184           /var/lib/dpkg.
185
186       --root=directory
187           Set the root directory to directory, which sets the administrative
188           directory to «directory/var/lib/dpkg» (since dpkg 1.21.0).
189
190       --load-avail
191           Also load the available file when using the --show and --list
192           commands, which now default to only querying the status file (since
193           dpkg 1.16.2).
194
195       --no-pager
196           Disables the use of any pager when showing information (since dpkg
197           1.19.2).
198
199       -f, --showformat=format
200           This option is used to specify the format of the output --show will
201           produce (short option since dpkg 1.13.1).  The format is a string
202           that will be output for each package listed.
203
204           In the format string, “\” introduces escapes:
205
206           \n newline
207           \r carriage return
208           \t tab
209
210\” before any other character suppresses any special meaning of
211           the following character, which is useful for “\” and “$”.
212
213           Package information can be included by inserting variable
214           references to package fields using the syntax “${field[;width]}”.
215           Fields are printed right-aligned unless the width is negative in
216           which case left alignment will be used. The following fields are
217           recognized but they are not necessarily available in the status
218           file (only internal fields or fields stored in the binary package
219           end up in it):
220
221           Architecture
222           Bugs
223           Conffiles (internal)
224           Config-Version (internal)
225           Conflicts
226           Breaks
227           Depends
228           Description
229           Enhances
230           Protected
231           Essential
232           Filename (internal, front-end related)
233           Homepage
234           Installed-Size
235           MD5sum (internal, front-end related)
236           MSDOS-Filename (internal, front-end related)
237           Maintainer
238           Origin
239           Package
240           Pre-Depends
241           Priority
242           Provides
243           Recommends
244           Replaces
245           Revision (obsolete)
246           Section
247           Size (internal, front-end related)
248           Source
249           Status (internal)
250           Suggests
251           Tag (usually not in .deb but in repository Packages files)
252           Triggers-Awaited (internal)
253           Triggers-Pending (internal)
254           Version
255
256           The following are virtual fields, generated by dpkg-query from
257           values from other fields (note that these do not use valid names
258           for fields in control files):
259
260           binary:Package
261               It contains the binary package name with a possible
262               architecture qualifier like “libc6:amd64” (since dpkg 1.16.2).
263               An architecture qualifier will be present to make the package
264               name unambiguous, for example if the package has a Multi-Arch
265               field with a value of same or the package is of a foreign
266               architecture.
267
268           binary:Synopsis
269               It contains the package short description (since dpkg 1.19.1).
270
271           binary:Summary
272               This is an alias for binary:Synopsis (since dpkg 1.16.2).
273
274           db:Status-Abbrev
275               It contains the abbreviated package status (as three
276               characters), such as “ii ” or “iHR” (since dpkg 1.16.2).  See
277               the --list command description for more details.
278
279           db:Status-Want
280               It contains the package wanted status, part of the Status field
281               (since dpkg 1.17.11).
282
283           db:Status-Status
284               It contains the package status word, part of the Status field
285               (since dpkg 1.17.11).
286
287           db:Status-Eflag
288               It contains the package status error flag, part of the Status
289               field (since dpkg 1.17.11).
290
291           db-fsys:Files
292               It contains the list of the package filesystem entries
293               separated by newlines (since dpkg 1.19.3).
294
295           db-fsys:Last-Modified
296               It contains the timestamp in seconds of the last time the
297               package filesystem entries were modified (since dpkg 1.19.3).
298
299           source:Package
300               It contains the source package name for this binary package
301               (since dpkg 1.16.2).
302
303           source:Version
304               It contains the source package version for this binary package
305               (since dpkg 1.16.2)
306
307           source:Upstream-Version
308               It contains the source package upstream version for this binary
309               package (since dpkg 1.18.16)
310
311           The default format string is “${binary:Package}\t${Version}\n”.
312           Actually, all other fields found in the status file (i.e. user
313           defined fields) can be requested, too. They will be printed as-is,
314           though, no conversion nor error checking is done on them. To get
315           the name of the dpkg maintainer and the installed version, you
316           could run:
317
318            dpkg-query -f='${binary:Package} ${Version}\t${Maintainer}\n' \
319             -W dpkg
320

EXIT STATUS

322       0   The requested query was successfully performed.
323
324       1   The requested query failed either fully or partially, due to no
325           file or package being found (except for --control-path,
326           --control-list and --control-show were such errors are fatal).
327
328       2   Fatal or unrecoverable error due to invalid command-line usage, or
329           interactions with the system, such as accesses to the database,
330           memory allocations, etc.
331

ENVIRONMENT

333   External environment
334       SHELL
335           Sets the program to execute when spawning a command via a shell
336           (since dpkg 1.19.2).
337
338       PAGER
339       DPKG_PAGER
340           Sets the pager command to use (since dpkg 1.19.1), which will be
341           executed with «$SHELL -c».  If SHELL is not set, «sh» will be used
342           instead.  The DPKG_PAGER overrides the PAGER environment variable
343           (since dpkg 1.19.2).
344
345       DPKG_ROOT
346           If set and the --root option has not been specified, it will be
347           used as the filesystem root directory (since dpkg 1.21.0).
348
349       DPKG_ADMINDIR
350           If set and the --admindir option has not been specified, it will be
351           used as the dpkg data directory.
352
353       DPKG_COLORS
354           Sets the color mode (since dpkg 1.18.5).  The currently accepted
355           values are: auto (default), always and never.
356
357   Internal environment
358       LESS
359           Defined by dpkg-query to “-FRSXMQ”, if not already set, when
360           spawning a pager (since dpkg 1.19.2).  To change the default
361           behavior, this variable can be preset to some other value including
362           an empty string, or the PAGER or DPKG_PAGER variables can be set to
363           disable specific options with «-+», for example DPKG_PAGER="less
364           -+F".
365

SEE ALSO

367       dpkg(1).
368
369
370
3711.21.9                            2022-07-01                     dpkg-query(1)
Impressum