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