1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
.\" dpkg manual page - dpkg-query(1)
.\"
.\" Copyright © 2001 Wichert Akkerman <wakkerma@debian.org>
.\" Copyright © 2006-2007 Frank Lichtenheld <djpig@debian.org>
.\" Copyright © 2006-2012 Guillem Jover <guillem@debian.org>
.\" Copyright © 2008-2011 Raphaël Hertzog <hertzog@debian.org>
.\"
.\" This is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.\" This is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program. If not, see <http://www.gnu.org/licenses/>.
.
.TH dpkg\-query 1 "2012-04-03" "Debian Project" "dpkg suite"
.SH NAME
dpkg\-query \- a tool to query the dpkg database
.
.SH SYNOPSIS
.B dpkg\-query
.RI [ option "...] " command
.
.SH DESCRIPTION
\fBdpkg\-query\fP is a tool to show information about packages listed in
the \fBdpkg\fP database.
.
.SH COMMANDS
.TP
.BR \-l ", " \-\-list " [\fIpackage-name-pattern\fP...]"
List packages matching given pattern. If no \fIpackage-name-pattern\fP
is given, list all packages in \fI/var/lib/dpkg/status\fP, excluding
the ones marked as not-installed (i.e. those which have been previously
purged). Normal shell wildchars are allowed
in \fIpackage-name-pattern\fP. Please note you will probably have to
quote \fIpackage-name-pattern\fP to prevent the shell from performing
filename expansion. For example this will list all package names starting
with \*(lqlibc6\*(rq:
.nf
\fBdpkg\-query \-l \(aqlibc6*\(aq\fP
.fi
The first three columns of the output show the desired action, the package
status, and errors, in that order.
Desired action:
.nf
u = Unknown
i = Install
h = Hold
r = Remove
p = Purge
.fi
Package status:
.nf
n = Not-installed
c = Config-files
H = Half-installed
U = Unpacked
F = Half-configured
W = Triggers-awaiting
t = Triggers-pending
i = Installed
.fi
Error flags:
.nf
<empty> = (none)
R = Reinst-required
.fi
An uppercase status or error letter indicates the package is likely to
cause severe problems. Please refer to \fBdpkg\fP(1) for information
about the above states and flags.
The output format of this option is not configurable, but varies
automatically to fit the terminal width. It is intended for human
readers, and is not easily machine-readable. See \fB\-W\fP (\fB\-\-show\fP)
and \fB\-\-showformat\fP for a way to configure the output format.
.TP
.BR \-W ", " \-\-show " [\fIpackage-name-pattern\fP...]"
Just like the \fB\-\-list\fP option this will list all packages matching
the given pattern. However the output can be customized using the
\fB\-\-showformat\fP option.
The default output format gives one line per matching package, each line
having the name (extended with the architecture qualifier for
\fBMulti\-Arch\fP \fBsame\fP packages) and installed version of the package,
separated by a tab.
.TP
.BR \-s ", " \-\-status " \fIpackage-name\fP..."
Report status of specified package. This just displays the entry in
the installed package status database. When multiple \fIpackage-name\fP
are listed, the requested status entries are separated by an empty line,
with the same order as specified on the argument list.
.TP
.BR \-L ", " \-\-listfiles " \fIpackage-name\fP..."
List files installed to your system from \fIpackage-name\fP. When multiple
\fIpackage-name\fP are listed, the requested lists of files are separated
by an empty line, with the same order as specified on the argument list.
However, note that files created by package-specific installation-scripts
are not listed.
.TP
.BR \-\-control\-list " \fIpackage-name\fP
List control files installed to your system from \fIpackage-name\fP.
These can be used as input arguments to \fB\-\-control\-show\fP.
.TP
.BR \-\-control\-show " \fIpackage-name\fP \fIcontrol-file\fP"
Print the \fIcontrol-file\fP installed to your system from \fIpackage-name\fP
to the standard output.
.TP
.BR \-c ", " \-\-control\-path " \fIpackage-name\fP [\fIcontrol-file\fP]"
List paths for control files installed to your system from \fIpackage-name\fP.
If \fIcontrol-file\fP is specified then only list the path for that control
file if it is present. \fBWarning\fP: this command is deprecated, please
switch to use \fB\-\-control\-list\fP and \fB\-\-control\-show\fP instead.
.TP
.BR \-S ", " \-\-search " \fIfilename-search-pattern\fP..."
Search for packages that own files corresponding to the given pattern.
Standard shell wildchars can be used in the pattern.
This command will not list extra files created by maintainer scripts,
nor will it list alternatives.
.TP
.BR \-p ", " \-\-print\-avail " \fIpackage-name\fP..."
Display details about \fIpackage-name\fP, as found in
\fI/var/lib/dpkg/available\fP. When multiple \fIpackage-name\fP are
listed, the requested \fIavailable\fP entries are separated by an empty
line, with the same order as specified on the argument list.
Users of APT-based frontends
should use \fBapt\-cache show\fP \fIpackage-name\fP instead
as the \fIavailable\fP file is only kept up-to-date when
using \fBdselect\fP.
.TP
.BR \-? ", " \-\-help
Show the usage message and exit.
.TP
.B \-\-version
Show the version and exit.
.
.SH OPTIONS
.TP
.BI \-\-admindir= dir
Change the location of the \fBdpkg\fR database. The default location is
\fI/var/lib/dpkg\fP.
.TP
.B \-\-load\-avail
Also load the available file when using the \fB\-\-show\fP and \fB\-\-list\fP
commands, which now default to only querying the status file.
.TP
.BR \-f ", " \-\-showformat=\fIformat\fR
This option is used to specify the format of the output \fB\-\-show\fP
will produce. The format is a string that will be output for each package
listed.
In the format string, \(lq\fB\e\fP\(rq introduces escapes:
.nf
\fB\en\fP newline
\fB\er\fP carriage return
\fB\et\fP tab
.fi
\(lq\fB\e\fP\(rq before any other character suppresses any special
meaning of the following character, which is useful for \(lq\fB\e\fP\(rq
and \(lq\fB$\fP\(rq.
Package information can be included by inserting
variable references to package fields using the syntax
\(lq\fB${\fP\fIfield\fR[\fB;\fP\fIwidth\fR]\fB}\fP\(rq. Fields are
printed right-aligned unless the width is negative in which case left
alignment will be used. The following \fIfield\fRs are recognized but
they are not necessarily available in the status file (only internal
fields or fields stored in the binary package end up in it):
.nf
\fBArchitecture\fP
\fBBugs\fP
\fBConffiles\fP (internal)
\fBConfig\-Version\fP (internal)
\fBConflicts\fP
\fBBreaks\fP
\fBDepends\fP
\fBDescription\fP
\fBEnhances\fP
\fBEssential\fP
\fBFilename\fP (internal, front-end related)
\fBHomepage\fP
\fBInstalled\-Size\fP
\fBMD5sum\fP (internal, front-end related)
\fBMSDOS\-Filename\fP (internal, front-end related)
\fBMaintainer\fP
\fBOrigin\fP
\fBPackage\fP
\fBPre\-Depends\fP
\fBPriority\fP
\fBProvides\fP
\fBRecommends\fP
\fBReplaces\fP
\fBRevision\fP (obsolete)
\fBSection\fP
\fBSize\fP (internal, front-end related)
\fBSource\fP
\fBStatus\fP (internal)
\fBSuggests\fP
\fBTag\fP (usually not in .deb but in repository Packages files)
\fBTriggers\-Awaited\fP (internal)
\fBTriggers\-Pending\fP (internal)
\fBVersion\fP
.fi
The following are virtual fields, generated by \fBdpkg\-query\fP from
values from other fields (note that these do not use valid names for
fields in control files):
.nf
\fBbinary:Package\fP
\fBbinary:Summary\fP
\fBdb:Status\-Abbrev\fP
\fBsource:Package\fP
\fBsource:Version\fP
.fi
The default format string is \(lq\fB${binary:Package}\et${Version}\en\fP\(rq.
Actually, all other fields found in the status file (i.e. user defined
fields) can be requested, too. They will be printed as-is, though, no
conversion nor error checking is done on them. \fBbinary:Package\fP is
a special field that will print the package name with an architecture
qualifier (like "libc6:amd64") if the package has a \fBMulti\-Arch\fP
field with a value of \fBsame\fP, and as such its name could be ambiguous.
To get the name of the \fBdpkg\fP maintainer and the installed version,
you could run:
.nf
\fBdpkg\-query \-W \-f=\(aq${binary:Package} ${Version}\\t${Maintainer}\\n\(aq dpkg\fP
.fi
.
.SH EXIT STATUS
.TP
.B 0
The requested query was successfully performed.
.TP
.B 1
Problems were encountered while parsing the command line or performing the
query, including no file or package being found (except for
\fB\-\-control\-path\fP).
.
.SH ENVIRONMENT
.TP
.B DPKG_ADMINDIR
If set and the \fB\-\-admindir\fP option has not been specified, it will
be used as the \fBdpkg\fP data directory.
.TP
\fBCOLUMNS\fP
This setting influences the output of the \fB\-\-list\fP option by changing
the width of its output.
.
.SH SEE ALSO
.BR dpkg (1).
|