dpkg-query.1 11 KB

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