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 packages matching given pattern. If no package-name-pattern
18 is given, list all packages in /var/lib/dpkg/status, excluding
19 the ones marked as not-installed (i.e. those which have been
20 previously purged). Normal shell wildcard characters are allowed
21 in package-name-pattern. Please note you will probably have to
22 quote package-name-pattern to prevent the shell from performing
23 filename expansion. For example this will list all package names
24 starting with “libc6”:
25
26 dpkg-query -l 'libc6*'
27
28 The first three columns of the output show the desired action,
29 the package status, and errors, in that order.
30
31 Desired action:
32 u = Unknown
33 i = Install
34 h = Hold
35 r = Remove
36 p = Purge
37
38 Package status:
39 n = Not-installed
40 c = Config-files
41 H = Half-installed
42 U = Unpacked
43 F = Half-configured
44 W = Triggers-awaiting
45 t = Triggers-pending
46 i = Installed
47
48 Error flags:
49 <empty> = (none)
50 R = Reinst-required
51
52 An uppercase status or error letter indicates the package is
53 likely to cause severe problems. Please refer to dpkg(1) for
54 information about the above states and flags.
55
56 The output format of this option is not configurable, but varies
57 automatically to fit the terminal width. It is intended for
58 human readers, and is not easily machine-readable. See -W
59 (--show) and --showformat for a way to configure the output
60 format.
61
62 -W, --show [package-name-pattern...]
63 Just like the --list option this will list all packages matching
64 the given pattern. However the output can be customized using
65 the --showformat option. The default output format gives one
66 line per matching package, each line having the name (extended
67 with the architecture qualifier for Multi-Arch same packages)
68 and installed version of the package, separated by a tab.
69
70 -s, --status package-name...
71 Report status of specified package. This just displays the entry
72 in the installed package status database. When multiple package-
73 name are listed, the requested status entries are separated by
74 an empty line, with the same order as specified on the argument
75 list.
76
77 -L, --listfiles package-name...
78 List files installed to your system from package-name. When
79 multiple package-name are listed, the requested lists of files
80 are separated by an empty line, with the same order as specified
81 on the argument list. However, note that files created by
82 package-specific installation-scripts are not listed.
83
84 --control-list package-name
85 List control files installed to your system from package-name
86 (since dpkg 1.16.5). These can be used as input arguments to
87 --control-show.
88
89 --control-show package-name control-file
90 Print the control-file installed to your system from package-
91 name to the standard output (since dpkg 1.16.5).
92
93 -c, --control-path package-name [control-file]
94 List paths for control files installed to your system from
95 package-name (since dpkg 1.15.4). If control-file is specified
96 then only list the path for that control file if it is present.
97
98 Warning: this command is deprecated as it gives direct access to
99 the internal dpkg database, please switch to use --control-list
100 and --control-show instead for all cases where those commands
101 might give the same end result. Although, as long as there is
102 still at least one case where this command is needed (i.e. when
103 having to remove a damaging postrm maintainer script), and while
104 there is no good solution for that, this command will not get
105 removed.
106
107 -S, --search filename-search-pattern...
108 Search for packages that own files corresponding to the given
109 pattern. Standard shell wildcard characters can be used in the
110 pattern, where asterisk (*) and question mark (?) will match a
111 slash, and blackslash (\) will be used as an escape character.
112
113 If the first character in the filename-search-pattern is none of
114 ‘*[?/’ then it will be considered a substring match and will be
115 implicitly surrounded by ‘*’ (as in *filename-search-pattern*).
116 If the subsequent string contains any of ‘*[?\’, then it will
117 handled like a glob pattern, otherwise any trailing ‘/’ or ‘/.’
118 will be removed and a literal path lookup will be performed.
119
120 This command will not list extra files created by maintainer
121 scripts, nor will it list alternatives.
122
123 -p, --print-avail package-name...
124 Display details about package-name, as found in
125 /var/lib/dpkg/available. When multiple package-name are listed,
126 the requested available entries are separated by an empty line,
127 with the same order as specified on the argument list.
128
129 Users of APT-based frontends should use apt-cache show package-
130 name instead as the available file is only kept up-to-date when
131 using dselect.
132
133 -?, --help
134 Show the usage message and exit.
135
136 --version
137 Show the version and exit.
138
140 --admindir=dir
141 Change the location of the dpkg database. The default location
142 is /var/lib/dpkg.
143
144 --load-avail
145 Also load the available file when using the --show and --list
146 commands, which now default to only querying the status file
147 (since dpkg 1.16.2).
148
149 -f, --showformat=format
150 This option is used to specify the format of the output --show
151 will produce. The format is a string that will be output for
152 each package listed.
153
154 In the format string, “\” introduces escapes:
155
156 \n newline
157 \r carriage return
158 \t tab
159
160 “\” before any other character suppresses any special meaning of
161 the following character, which is useful for “\” and “$”.
162
163 Package information can be included by inserting variable
164 references to package fields using the syntax
165 “${field[;width]}”. Fields are printed right-aligned unless the
166 width is negative in which case left alignment will be used. The
167 following fields are recognized but they are not necessarily
168 available in the status file (only internal fields or fields
169 stored in the binary package end up in it):
170
171 Architecture
172 Bugs
173 Conffiles (internal)
174 Config-Version (internal)
175 Conflicts
176 Breaks
177 Depends
178 Description
179 Enhances
180 Essential
181 Filename (internal, front-end related)
182 Homepage
183 Installed-Size
184 MD5sum (internal, front-end related)
185 MSDOS-Filename (internal, front-end related)
186 Maintainer
187 Origin
188 Package
189 Pre-Depends
190 Priority
191 Provides
192 Recommends
193 Replaces
194 Revision (obsolete)
195 Section
196 Size (internal, front-end related)
197 Source
198 Status (internal)
199 Suggests
200 Tag (usually not in .deb but in repository Packages files)
201 Triggers-Awaited (internal)
202 Triggers-Pending (internal)
203 Version
204
205 The following are virtual fields, generated by dpkg-query from
206 values from other fields (note that these do not use valid names
207 for fields in control files):
208
209 binary:Package
210 It contains the binary package name with a possible
211 architecture qualifier like “libc6:amd64” (since dpkg
212 1.16.2). An architecture qualifier will be present to
213 make the package name unambiguous, for example if the
214 package has a Multi-Arch field with a value of same or
215 the package is of a foreign architecture.
216
217 binary:Summary
218 It contains the package short description (since dpkg
219 1.16.2).
220
221 db:Status-Abbrev
222 It contains the abbreviated package status (as three
223 characters), such as “ii ” or “iHR” (since dpkg 1.16.2).
224 See the --list command description for more details.
225
226 db:Status-Want
227 It contains the package wanted status, part of the Status
228 field (since dpkg 1.17.11).
229
230 db:Status-Status
231 It contains the package status word, part of the Status
232 field (since dpkg 1.17.11).
233
234 db:Status-Eflag
235 It contains the package status error flag, part of the
236 Status field (since dpkg 1.17.11).
237
238 source:Package
239 It contains the source package name for this binary
240 package (since dpkg 1.16.2).
241
242 source:Version
243 It contains the source package version for this binary
244 package (since dpkg 1.16.2)
245
246 source:Upstream-Version
247 It contains the source package upstream version for this
248 binary package (since dpkg 1.18.16)
249
250 The default format string is “${binary:Package}\t${Version}\n”.
251 Actually, all other fields found in the status file (i.e. user
252 defined fields) can be requested, too. They will be printed as-
253 is, though, no conversion nor error checking is done on them. To
254 get the name of the dpkg maintainer and the installed version,
255 you could run:
256
257 dpkg-query -W -f='${binary:Package} ${Version}\t${Maintainer}\n' dpkg
258
260 0 The requested query was successfully performed.
261
262 1 The requested query failed either fully or partially, due to no
263 file or package being found (except for --control-path,
264 --control-list and --control-show were such errors are fatal).
265
266 2 Fatal or unrecoverable error due to invalid command-line usage,
267 or interactions with the system, such as accesses to the
268 database, memory allocations, etc.
269
271 DPKG_ADMINDIR
272 If set and the --admindir option has not been specified, it will
273 be used as the dpkg data directory.
274
275 COLUMNS
276 This setting influences the output of the --list option by
277 changing the width of its output.
278
280 dpkg(1).
281
282
283
284
2851.18.25 2018-06-26 dpkg-query(1)