1dpkg-query(1) dpkg suite dpkg-query(1)
2
3
4
6 dpkg-query - a tool to query the dpkg database
7
9 dpkg-query [option...] command
10
12 dpkg-query is a tool to show information about packages listed in the
13 dpkg database.
14
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.
70
71 The default output format gives one line per matching package, each
72 line consisting of the package name and its installed version,
73 separated by a tab. The package name will be architecture
74 qualified for packages with a Multi-Arch field with the value same
75 or with a foreign architecture, which is an architecture that is
76 neither the native one nor all.
77
78 -s, --status [package-name...]
79 Report status of specified packages. This just displays the entry
80 in the installed package status database. If no package-name is
81 specified it will display all package entries in the status
82 database (since dpkg 1.19.1). When multiple package-name entries
83 are listed, the requested status entries are separated by an empty
84 line, with the same order as specified on the argument list.
85
86 -L, --listfiles package-name...
87 List files installed to your system from package-name. When
88 multiple package-names are listed, the requested lists of files are
89 separated by an empty line, with the same order as specified on the
90 argument list.
91
92 Each file diversion is printed on its own line after its diverted
93 file, prefixed with one of the following localized strings:
94
95
96 locally diverted to: diverted-to
97 package diverts others to: diverted-to
98 diverted by pkg to: diverted-to
99
100 Hint: When machine parsing the output, it is customary to set the
101 locale to C.UTF-8 to get reproducible results.
102
103 This command will not list extra files created by maintainer
104 scripts, nor will it list alternatives.
105
106 --control-list package-name
107 List control files installed to your system from package-name
108 (since dpkg 1.16.5). These can be used as input arguments to
109 --control-show.
110
111 --control-show package-name control-file
112 Print the control-file installed to your system from package-name
113 to the standard output (since dpkg 1.16.5).
114
115 -c, --control-path package-name [control-file]
116 List paths for control files installed to your system from package-
117 name (since dpkg 1.15.4). If control-file is specified then only
118 list the path for that control file if it is present.
119
120 Warning: this command is deprecated as it gives direct access to
121 the internal dpkg database, please switch to use --control-list and
122 --control-show instead for all cases where those commands might
123 give the same end result. Although, as long as there is still at
124 least one case where this command is needed (i.e. when having to
125 remove a damaging postrm maintainer script), and while there is no
126 good solution for that, this command will not get removed.
127
128 -S, --search filename-search-pattern...
129 Search for packages that own files corresponding to the given
130 patterns. Standard shell wildcard characters can be used in the
131 pattern, where asterisk (*) and question mark (?) will match a
132 slash, and backslash (\) will be used as an escape character.
133
134 If the first character in the filename-search-pattern is none of
135 ‘*[?/’ then it will be considered a substring match and will be
136 implicitly surrounded by ‘*’ (as in *filename-search-pattern*). If
137 the subsequent string contains any of ‘*[?\’, then it will handled
138 like a glob pattern, otherwise any trailing ‘/’ or ‘/.’ will be
139 removed and a literal path lookup will be performed.
140
141 This command will not list extra files created by maintainer
142 scripts, nor will it list alternatives.
143
144 The output format consists of one line per matching pattern, with a
145 list of packages owning the pathname separated by a comma (U+002C
146 ‘,’) and a space (U+0020 ‘ ’), followed by a colon (U+003A ‘:’) and
147 a space, followed by the pathname. As in:
148
149 pkgname1, pkgname2: pathname1
150 pkgname3: pathname2
151
152 File diversions are printed with the following localized strings:
153
154
155 diversion by pkgname from: diverted-from
156 diversion by pkgname to: diverted-to
157
158 or for local diversions:
159
160
161 local diversion from: diverted-from
162 local diversion to: diverted-to
163
164 Hint: When machine parsing the output, it is customary to set the
165 locale to C.UTF-8 to get reproducible results.
166
167 -p, --print-avail [package-name...]
168 Display details about packages, as found in
169 /var/lib/dpkg/available. If no package-name is specified, it will
170 display all package entries in the available database (since dpkg
171 1.19.1). When multiple package-name are listed, the requested
172 available entries are separated by an empty line, with the same
173 order as specified on the argument list.
174
175 Users of APT-based frontends should use apt show package-name
176 instead as the available file is only kept up-to-date when using
177 dselect.
178
179 -?, --help
180 Show the usage message and exit.
181
182 --version
183 Show the version and exit.
184
186 --admindir=dir
187 Change the location of the dpkg database. The default location is
188 /var/lib/dpkg.
189
190 --root=directory
191 Set the root directory to directory, which sets the administrative
192 directory to «directory/var/lib/dpkg» (since dpkg 1.21.0).
193
194 --load-avail
195 Also load the available file when using the --show and --list
196 commands, which now default to only querying the status file (since
197 dpkg 1.16.2).
198
199 --no-pager
200 Disables the use of any pager when showing information (since dpkg
201 1.19.2).
202
203 -f, --showformat=format
204 This option is used to specify the format of the output --show will
205 produce (short option since dpkg 1.13.1). The format is a string
206 that will be output for each package listed.
207
208 In the format string, “\” introduces escapes:
209
210 \n newline
211 \r carriage return
212 \t tab
213
214 “\” before any other character suppresses any special meaning of
215 the following character, which is useful for “\” and “$”.
216
217 Package information can be included by inserting variable
218 references to package fields using the syntax “${field[;width]}”.
219 Fields are printed right-aligned unless the width is negative in
220 which case left alignment will be used. The following fields are
221 recognized but they are not necessarily available in the status
222 file (only internal fields or fields stored in the binary package
223 end up in it):
224
225 Architecture
226 Bugs
227 Conffiles (internal)
228 Config-Version (internal)
229 Conflicts
230 Breaks
231 Depends
232 Description
233 Enhances
234 Protected
235 Essential
236 Filename (internal, front-end related)
237 Homepage
238 Installed-Size
239 MD5sum (internal, front-end related)
240 MSDOS-Filename (internal, front-end related)
241 Maintainer
242 Origin
243 Package
244 Pre-Depends
245 Priority
246 Provides
247 Recommends
248 Replaces
249 Revision (obsolete)
250 Section
251 Size (internal, front-end related)
252 Source
253 Status (internal)
254 Suggests
255 Tag (usually not in .deb but in repository Packages files)
256 Triggers-Awaited (internal)
257 Triggers-Pending (internal)
258 Version
259
260 The following are virtual fields, generated by dpkg-query from
261 values from other fields (note that these do not use valid names
262 for fields in control files):
263
264 binary:Package
265 It contains the binary package name with a possible
266 architecture qualifier like “libc6:amd64” (since dpkg 1.16.2).
267 An architecture qualifier will be present to make the package
268 name unambiguous, for packages with a Multi-Arch field with the
269 value same or with a foreign architecture, which is an
270 architecture that is neither the native one nor all.
271
272 binary:Synopsis
273 It contains the package short description (since dpkg 1.19.1).
274
275 binary:Summary
276 This is an alias for binary:Synopsis (since dpkg 1.16.2).
277
278 db:Status-Abbrev
279 It contains the abbreviated package status (as three
280 characters), such as “ii ” or “iHR” (since dpkg 1.16.2). See
281 the --list command description for more details.
282
283 db:Status-Want
284 It contains the package wanted status, part of the Status field
285 (since dpkg 1.17.11).
286
287 db:Status-Status
288 It contains the package status word, part of the Status field
289 (since dpkg 1.17.11).
290
291 db:Status-Eflag
292 It contains the package status error flag, part of the Status
293 field (since dpkg 1.17.11).
294
295 db-fsys:Files
296 It contains the list of the package filesystem entries
297 separated by newlines (since dpkg 1.19.3).
298
299 db-fsys:Last-Modified
300 It contains the timestamp in seconds of the last time the
301 package filesystem entries were modified (since dpkg 1.19.3).
302
303 source:Package
304 It contains the source package name for this binary package
305 (since dpkg 1.16.2).
306
307 source:Version
308 It contains the source package version for this binary package
309 (since dpkg 1.16.2)
310
311 source:Upstream-Version
312 It contains the source package upstream version for this binary
313 package (since dpkg 1.18.16)
314
315 The default format string is “${binary:Package}\t${Version}\n”.
316 Actually, all other fields found in the status file (i.e. user
317 defined fields) can be requested, too. They will be printed as-is,
318 though, no conversion nor error checking is done on them. To get
319 the name of the dpkg maintainer and the installed version, you
320 could run:
321
322 dpkg-query -f='${binary:Package} ${Version}\t${Maintainer}\n' \
323 -W dpkg
324
326 0 The requested query was successfully performed.
327
328 1 The requested query failed either fully or partially, due to no
329 file or package being found (except for --control-path,
330 --control-list and --control-show were such errors are fatal).
331
332 2 Fatal or unrecoverable error due to invalid command-line usage, or
333 interactions with the system, such as accesses to the database,
334 memory allocations, etc.
335
337 External environment
338 SHELL
339 Sets the program to execute when spawning a command via a shell
340 (since dpkg 1.19.2).
341
342 PAGER
343 DPKG_PAGER
344 Sets the pager command to use (since dpkg 1.19.1), which will be
345 executed with «$SHELL -c». If SHELL is not set, «sh» will be used
346 instead. The DPKG_PAGER overrides the PAGER environment variable
347 (since dpkg 1.19.2).
348
349 DPKG_ROOT
350 If set and the --root option has not been specified, it will be
351 used as the filesystem root directory (since dpkg 1.21.0).
352
353 DPKG_ADMINDIR
354 If set and the --admindir option has not been specified, it will be
355 used as the dpkg data directory.
356
357 DPKG_DEBUG
358 Sets the debug mask (since dpkg 1.21.10) from an octal value. The
359 currently accepted flags are described in the dpkg --debug option,
360 but not all these flags might have an effect on this program.
361
362 DPKG_COLORS
363 Sets the color mode (since dpkg 1.18.5). The currently accepted
364 values are: auto (default), always and never.
365
366 Internal environment
367 LESS
368 Defined by dpkg-query to “-FRSXMQ”, if not already set, when
369 spawning a pager (since dpkg 1.19.2). To change the default
370 behavior, this variable can be preset to some other value including
371 an empty string, or the PAGER or DPKG_PAGER variables can be set to
372 disable specific options with «-+», for example DPKG_PAGER="less
373 -+F".
374
376 dpkg(1).
377
378
379
3801.21.21 2023-02-25 dpkg-query(1)