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,
18 regardless of their status, which includes any real or virtual
19 package referenced in any dependency relationship field (such as
20 Breaks, Enhances, etc.). If no package-name-pattern is given,
21 list all packages in /var/lib/dpkg/status, excluding the ones
22 marked as not-installed (i.e. those which have been previously
23 purged). Normal shell wildcard characters are allowed in
24 package-name-pattern. Please note you will probably have to
25 quote package-name-pattern to prevent the shell from performing
26 filename expansion. For example this will list all package
27 names starting with “libc6”:
28
29 dpkg-query -l 'libc6*'
30
31 The first three columns of the output show the desired action,
32 the package status, and errors, in that order.
33
34 Desired action:
35 u = Unknown
36 i = Install
37 h = Hold
38 r = Remove
39 p = Purge
40
41 Package status:
42 n = Not-installed
43 c = Config-files
44 H = Half-installed
45 U = Unpacked
46 F = Half-configured
47 W = Triggers-awaiting
48 t = Triggers-pending
49 i = Installed
50
51 Error flags:
52 <empty> = (none)
53 R = Reinst-required
54
55 An uppercase status or error letter indicates the package is
56 likely to cause severe problems. Please refer to dpkg(1) for
57 information about the above states and flags.
58
59 The output format of this option is not configurable, but varies
60 automatically to fit the terminal width. It is intended for
61 human readers, and is not easily machine-readable. See -W
62 (--show) and --showformat for a way to configure the output
63 format.
64
65 -W, --show [package-name-pattern...]
66 Just like the --list option this will list all packages matching
67 the given pattern. However the output can be customized using
68 the --showformat option. The default output format gives one
69 line per matching package, each line having the name (extended
70 with the architecture qualifier for Multi-Arch same packages)
71 and installed version of the package, separated by a tab.
72
73 -s, --status [package-name...]
74 Report status of specified package. This just displays the entry
75 in the installed package status database. If no package-name is
76 specified it will display all package entries in the status
77 database (since dpkg 1.19.1). When multiple package-name
78 entries are listed, the requested status entries are separated
79 by an empty line, with the same order as specified on the
80 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
85 are separated by an empty line, with the same order as specified
86 on the argument list. However, note that files created by
87 package-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-
96 name 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
100 package-name (since dpkg 1.15.4). If control-file is specified
101 then only 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
105 and --control-show instead for all cases where those commands
106 might give the same end result. Although, as long as there is
107 still at least one case where this command is needed (i.e. when
108 having to remove a damaging postrm maintainer script), and while
109 there is no good solution for that, this command will not get
110 removed.
111
112 -S, --search filename-search-pattern...
113 Search for packages that own files corresponding to the given
114 pattern. Standard shell wildcard characters can be used in the
115 pattern, where asterisk (*) and question mark (?) will match a
116 slash, and backslash (\) will be used as an escape character.
117
118 If the first character in the filename-search-pattern is none of
119 ‘*[?/’ then it will be considered a substring match and will be
120 implicitly surrounded by ‘*’ (as in *filename-search-pattern*).
121 If the subsequent string contains any of ‘*[?\’, then it will
122 handled like a glob pattern, otherwise any trailing ‘/’ or ‘/.’
123 will be removed and a literal path lookup will be performed.
124
125 This command will not list extra files created by maintainer
126 scripts, nor will it list alternatives.
127
128 -p, --print-avail [package-name...]
129 Display details about packages, as found in
130 /var/lib/dpkg/available. If no package-name is specified, it
131 will display all package entries in the available database
132 (since dpkg 1.19.1). When multiple package-name are listed, the
133 requested available entries are separated by an empty line, with
134 the same order as specified on the argument list.
135
136 Users of APT-based frontends should use apt-cache show package-
137 name instead as the available file is only kept up-to-date when
138 using dselect.
139
140 -?, --help
141 Show the usage message and exit.
142
143 --version
144 Show the version and exit.
145
147 --admindir=dir
148 Change the location of the dpkg database. The default location
149 is /var/lib/dpkg.
150
151 --load-avail
152 Also load the available file when using the --show and --list
153 commands, which now default to only querying the status file
154 (since dpkg 1.16.2).
155
156 --no-pager
157 Disables the use of any pager when showing information (since
158 dpkg 1.19.2).
159
160 -f, --showformat=format
161 This option is used to specify the format of the output --show
162 will produce (short option since dpkg 1.13.1). The format is a
163 string that will be output for each package listed.
164
165 In the format string, “\” introduces escapes:
166
167 \n newline
168 \r carriage return
169 \t tab
170
171 “\” before any other character suppresses any special meaning of
172 the following character, which is useful for “\” and “$”.
173
174 Package information can be included by inserting variable
175 references to package fields using the syntax
176 “${field[;width]}”. Fields are printed right-aligned unless the
177 width is negative in which case left alignment will be used. The
178 following fields are recognized but they are not necessarily
179 available in the status file (only internal fields or fields
180 stored in the binary package end up in it):
181
182 Architecture
183 Bugs
184 Conffiles (internal)
185 Config-Version (internal)
186 Conflicts
187 Breaks
188 Depends
189 Description
190 Enhances
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
223 1.16.2). An architecture qualifier will be present to
224 make the package name unambiguous, for example if the
225 package has a Multi-Arch field with a value of same or
226 the package is of a foreign architecture.
227
228 binary:Synopsis
229 It contains the package short description (since dpkg
230 1.19.1).
231
232 binary:Summary
233 This is an alias for binary:Synopsis (since dpkg 1.16.2).
234
235 db:Status-Abbrev
236 It contains the abbreviated package status (as three
237 characters), such as “ii ” or “iHR” (since dpkg 1.16.2).
238 See the --list command description for more details.
239
240 db:Status-Want
241 It contains the package wanted status, part of the Status
242 field (since dpkg 1.17.11).
243
244 db:Status-Status
245 It contains the package status word, part of the Status
246 field (since dpkg 1.17.11).
247
248 db:Status-Eflag
249 It contains the package status error flag, part of the
250 Status field (since dpkg 1.17.11).
251
252 db-fsys:Files
253 It contains the list of the package filesystem entries
254 separated by newlines (since dpkg 1.19.3).
255
256 db-fsys:Last-Modified
257 It contains the timestamp in seconds of the last time the
258 package filesystem entries were modified (since dpkg
259 1.19.3).
260
261 source:Package
262 It contains the source package name for this binary
263 package (since dpkg 1.16.2).
264
265 source:Version
266 It contains the source package version for this binary
267 package (since dpkg 1.16.2)
268
269 source:Upstream-Version
270 It contains the source package upstream version for this
271 binary package (since dpkg 1.18.16)
272
273 The default format string is “${binary:Package}\t${Version}\n”.
274 Actually, all other fields found in the status file (i.e. user
275 defined fields) can be requested, too. They will be printed as-
276 is, though, no conversion nor error checking is done on them. To
277 get the name of the dpkg maintainer and the installed version,
278 you could run:
279
280 dpkg-query -W -f='${binary:Package} ${Version}\t${Maintainer}\n' dpkg
281
283 0 The requested query was successfully performed.
284
285 1 The requested query failed either fully or partially, due to no
286 file or package being found (except for --control-path,
287 --control-list and --control-show were such errors are fatal).
288
289 2 Fatal or unrecoverable error due to invalid command-line usage,
290 or interactions with the system, such as accesses to the
291 database, memory allocations, etc.
292
294 External environment
295 SHELL 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
302 used instead. The DPKG_PAGER overrides the PAGER environment
303 variable (since dpkg 1.19.2).
304
305 DPKG_ADMINDIR
306 If set and the --admindir option has not been specified, it will
307 be 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 Defined by dpkg-query to “-FRSXMQ”, if not already set, when
315 spawning a pager (since dpkg 1.19.2). To change the default
316 behavior, this variable can be preset to some other value
317 including an empty string, or the PAGER or DPKG_PAGER variables
318 can be set to disable specific options with «-+», for example
319 DPKG_PAGER="less -+F".
320
322 dpkg(1).
323
324
325
326
3271.19.7 2019-06-03 dpkg-query(1)