dpkg-query.man 11 KB

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