dpkg-query.1 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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-2012 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 "2012-04-03" "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 wildchars 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. These can be used as input arguments to \fB\-\-control\-show\fP.
  106. .TP
  107. .BR \-\-control\-show " \fIpackage-name\fP \fIcontrol-file\fP"
  108. Print the \fIcontrol-file\fP installed to your system from \fIpackage-name\fP
  109. to the standard output.
  110. .TP
  111. .BR \-c ", " \-\-control\-path " \fIpackage-name\fP [\fIcontrol-file\fP]"
  112. List paths for control files installed to your system from \fIpackage-name\fP.
  113. If \fIcontrol-file\fP is specified then only list the path for that control
  114. file if it is present.
  115. \fBWarning\fP: this command is deprecated as it gives direct access to the
  116. internal dpkg database, please switch to use \fB\-\-control\-list\fP and
  117. \fB\-\-control\-show\fP instead for all cases where those commands might
  118. give the same end result. Although there is still at least one case where
  119. this command is needed (i.e. when having to remove a damaging postrm
  120. maintainer script), and as long as there is no good solution for that,
  121. this command will not get removed.
  122. .TP
  123. .BR \-S ", " \-\-search " \fIfilename-search-pattern\fP..."
  124. Search for packages that own files corresponding to the given pattern.
  125. Standard shell wildchars can be used in the pattern.
  126. This command will not list extra files created by maintainer scripts,
  127. nor will it list alternatives.
  128. .TP
  129. .BR \-p ", " \-\-print\-avail " \fIpackage-name\fP..."
  130. Display details about \fIpackage-name\fP, as found in
  131. \fI/var/lib/dpkg/available\fP. When multiple \fIpackage-name\fP are
  132. listed, the requested \fIavailable\fP entries are separated by an empty
  133. line, with the same order as specified on the argument list.
  134. Users of APT-based frontends
  135. should use \fBapt\-cache show\fP \fIpackage-name\fP instead
  136. as the \fIavailable\fP file is only kept up-to-date when
  137. using \fBdselect\fP.
  138. .TP
  139. .BR \-? ", " \-\-help
  140. Show the usage message and exit.
  141. .TP
  142. .B \-\-version
  143. Show the version and exit.
  144. .
  145. .SH OPTIONS
  146. .TP
  147. .BI \-\-admindir= dir
  148. Change the location of the \fBdpkg\fR database. The default location is
  149. \fI/var/lib/dpkg\fP.
  150. .TP
  151. .B \-\-load\-avail
  152. Also load the available file when using the \fB\-\-show\fP and \fB\-\-list\fP
  153. commands, which now default to only querying the status file.
  154. .TP
  155. .BR \-f ", " \-\-showformat=\fIformat\fR
  156. This option is used to specify the format of the output \fB\-\-show\fP
  157. will produce. The format is a string that will be output for each package
  158. listed.
  159. In the format string, \(lq\fB\e\fP\(rq introduces escapes:
  160. .nf
  161. \fB\en\fP newline
  162. \fB\er\fP carriage return
  163. \fB\et\fP tab
  164. .fi
  165. \(lq\fB\e\fP\(rq before any other character suppresses any special
  166. meaning of the following character, which is useful for \(lq\fB\e\fP\(rq
  167. and \(lq\fB$\fP\(rq.
  168. Package information can be included by inserting
  169. variable references to package fields using the syntax
  170. \(lq\fB${\fP\fIfield\fR[\fB;\fP\fIwidth\fR]\fB}\fP\(rq. Fields are
  171. printed right-aligned unless the width is negative in which case left
  172. alignment will be used. The following \fIfield\fRs are recognized but
  173. they are not necessarily available in the status file (only internal
  174. fields or fields stored in the binary package end up in it):
  175. .nf
  176. \fBArchitecture\fP
  177. \fBBugs\fP
  178. \fBConffiles\fP (internal)
  179. \fBConfig\-Version\fP (internal)
  180. \fBConflicts\fP
  181. \fBBreaks\fP
  182. \fBDepends\fP
  183. \fBDescription\fP
  184. \fBEnhances\fP
  185. \fBEssential\fP
  186. \fBFilename\fP (internal, front-end related)
  187. \fBHomepage\fP
  188. \fBInstalled\-Size\fP
  189. \fBMD5sum\fP (internal, front-end related)
  190. \fBMSDOS\-Filename\fP (internal, front-end related)
  191. \fBMaintainer\fP
  192. \fBOrigin\fP
  193. \fBPackage\fP
  194. \fBPre\-Depends\fP
  195. \fBPriority\fP
  196. \fBProvides\fP
  197. \fBRecommends\fP
  198. \fBReplaces\fP
  199. \fBRevision\fP (obsolete)
  200. \fBSection\fP
  201. \fBSize\fP (internal, front-end related)
  202. \fBSource\fP
  203. \fBStatus\fP (internal)
  204. \fBSuggests\fP
  205. \fBTag\fP (usually not in .deb but in repository Packages files)
  206. \fBTriggers\-Awaited\fP (internal)
  207. \fBTriggers\-Pending\fP (internal)
  208. \fBVersion\fP
  209. .fi
  210. The following are virtual fields, generated by \fBdpkg\-query\fP from
  211. values from other fields (note that these do not use valid names for
  212. fields in control files):
  213. .nf
  214. \fBbinary:Package\fP
  215. \fBbinary:Summary\fP
  216. \fBdb:Status\-Abbrev\fP
  217. \fBsource:Package\fP
  218. \fBsource:Version\fP
  219. .fi
  220. The default format string is \(lq\fB${binary:Package}\et${Version}\en\fP\(rq.
  221. Actually, all other fields found in the status file (i.e. user defined
  222. fields) can be requested, too. They will be printed as-is, though, no
  223. conversion nor error checking is done on them. \fBbinary:Package\fP is
  224. a special field that will print the package name with an architecture
  225. qualifier (like "libc6:amd64") if the package has a \fBMulti\-Arch\fP
  226. field with a value of \fBsame\fP, and as such its name could be ambiguous.
  227. To get the name of the \fBdpkg\fP maintainer and the installed version,
  228. you could run:
  229. .nf
  230. \fBdpkg\-query \-W \-f=\(aq${binary:Package} ${Version}\\t${Maintainer}\\n\(aq dpkg\fP
  231. .fi
  232. .
  233. .SH EXIT STATUS
  234. .TP
  235. .B 0
  236. The requested query was successfully performed.
  237. .TP
  238. .B 1
  239. Problems were encountered while parsing the command line or performing the
  240. query, including no file or package being found (except for
  241. \fB\-\-control\-path\fP).
  242. .
  243. .SH ENVIRONMENT
  244. .TP
  245. .B DPKG_ADMINDIR
  246. If set and the \fB\-\-admindir\fP option has not been specified, it will
  247. be used as the \fBdpkg\fP data directory.
  248. .TP
  249. \fBCOLUMNS\fP
  250. This setting influences the output of the \fB\-\-list\fP option by changing
  251. the width of its output.
  252. .
  253. .SH SEE ALSO
  254. .BR dpkg (1).