File: dpkg-query.1

package info (click to toggle)
dpkg 1.15.11
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 32,212 kB
  • ctags: 3,725
  • sloc: ansic: 23,363; perl: 13,947; sh: 6,860; cpp: 4,545; makefile: 996; lex: 209; sed: 16
file content (210 lines) | stat: -rw-r--r-- 6,719 bytes parent folder | download | duplicates (2)
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
.TH dpkg\-query 1 "2010-03-07" "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 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.
.TP
.BR \-L ", " \-\-listfiles " \fIpackage-name\fP..."
List files installed to your system from \fIpackage-name\fP.
However, note that files created by package-specific
installation-scripts are not listed.
.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 semi-public, it should
be used only as a last resort solution, and if no other interface is
available. It might get deprecated later on if better interfaces or the
current architectural deficiencies have been solved.
.TP
.BR \-S ", " \-\-search " \fIfilename-search-pattern\fP..."
Search for a filename from installed packages. All 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. 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 \-h ", " \-\-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
.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 recognised 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, dselect related)
    \fBHomepage\fP
    \fBInstalled\-Size\fP
    \fBMD5sum\fP (internal, dselect related)
    \fBMSDOS\-Filename\fP (internal, dselect 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, dselect related)
    \fBSource\fP
    \fBStatus\fP (internal)
    \fBSuggests\fP
    \fBTag\fP (usually not in the .deb but in APT's Packages files)
    \fBTriggers-Awaited\fP (internal)
    \fBTriggers-Pending\fP (internal)
    \fBVersion\fP
.fi

The default format string is \(lq\fB${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.
To get the name of the dpkg maintainer and the installed version, you could
run:

.nf
  \fBdpkg\-query \-W \-f=\(aq${Package} ${Version}\\t${Maintainer}\\n\(aq dpkg\fP
.fi
.
.SH "EXIT STATUS"
.IP 0
The requested query was successfully performed.
.IP 1
Problems were encountered while parsing the command line or performing the
query, including no file or package being found (except for \-\-control\-path).
.
.SH ENVIRONMENT
.TP
\fBCOLUMNS\fP
This setting influences the output of the \fB\-\-list\fP option by changing
the width of its output.
.
.SH AUTHOR
Copyright \(co 2001 Wichert Akkerman
.sp
This is free software; see the GNU General Public Licence version 2 or
later for copying conditions. There is NO WARRANTY.
.
.SH SEE ALSO
.BR dpkg (1).