apt-cache.8.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <?xml version="1.0" encoding="utf-8" standalone="no"?>
  2. <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % aptent SYSTEM "apt.ent"> %aptent;
  5. <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent"> %aptverbatiment;
  6. <!ENTITY % aptvendor SYSTEM "apt-vendor.ent"> %aptvendor;
  7. ]>
  8. <refentry>
  9. <refentryinfo>
  10. &apt-author.jgunthorpe;
  11. &apt-author.team;
  12. &apt-email;
  13. &apt-product;
  14. <!-- The last update date -->
  15. <date>2016-11-25T00:00:00Z</date>
  16. </refentryinfo>
  17. <refmeta>
  18. <refentrytitle>apt-cache</refentrytitle>
  19. <manvolnum>8</manvolnum>
  20. <refmiscinfo class="manual">APT</refmiscinfo>
  21. </refmeta>
  22. <!-- Man page title -->
  23. <refnamediv>
  24. <refname>apt-cache</refname>
  25. <refpurpose>query the APT cache</refpurpose>
  26. </refnamediv>
  27. &synopsis-command-apt-cache;
  28. <refsect1><title>Description</title>
  29. <para>
  30. <command>apt-cache</command> performs a variety of operations on APT's
  31. package cache. <command>apt-cache</command> does not manipulate the
  32. state of the system but does provide operations to search and generate
  33. interesting output from the package metadata. The metadata is acquired
  34. and updated via the 'update' command of e.g. <command>apt-get</command>,
  35. so that it can be outdated if the last update is too long ago, but in
  36. exchange <command>apt-cache</command> works independently of the
  37. availability of the configured sources (e.g. offline).
  38. </para>
  39. <para>Unless the <option>-h</option>, or <option>--help</option> option is given, one of the
  40. commands below must be present.</para>
  41. <variablelist>
  42. <varlistentry><term><option>gencaches</option></term>
  43. <listitem><para><literal>gencaches</literal> creates APT's package cache. This is done
  44. implicitly by all commands needing this cache if it is missing or outdated.</para></listitem>
  45. </varlistentry>
  46. <varlistentry><term><option>showpkg</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
  47. <listitem><para><literal>showpkg</literal> displays information about the packages listed on the
  48. command line. Remaining arguments are package names. The available
  49. versions and reverse dependencies of each package listed are listed, as
  50. well as forward dependencies for each version. Forward (normal)
  51. dependencies are those packages upon which the package in question
  52. depends; reverse dependencies are those packages that depend upon the
  53. package in question. Thus, forward dependencies must be satisfied for a
  54. package, but reverse dependencies need not be.
  55. For instance, <command>apt-cache showpkg libreadline2</command> would produce
  56. output similar to the following:</para>
  57. <informalexample><programlisting>
  58. Package: libreadline2
  59. Versions: 2.1-12(/var/state/apt/lists/foo_Packages),
  60. Reverse Depends:
  61. libreadlineg2,libreadline2
  62. libreadline2-altdev,libreadline2
  63. Dependencies:
  64. 2.1-12 - libc5 (2 5.4.0-0) ncurses3.0 (0 (null))
  65. Provides:
  66. 2.1-12 -
  67. Reverse Provides:
  68. </programlisting></informalexample>
  69. <para>Thus it may be seen that libreadline2, version 2.1-12, depends on
  70. libc5 and ncurses3.0 which must be installed for libreadline2 to work.
  71. In turn, libreadlineg2 and libreadline2-altdev depend on libreadline2. If
  72. libreadline2 is installed, libc5 and ncurses3.0 (and ldso) must also be
  73. installed; libreadlineg2 and libreadline2-altdev do not have to be
  74. installed. For the specific meaning of the remainder of the output it
  75. is best to consult the apt source code.</para></listitem>
  76. </varlistentry>
  77. <varlistentry><term><option>stats</option></term><listitem><para><literal>stats</literal> displays some statistics about the cache.
  78. No further arguments are expected. Statistics reported are:
  79. <itemizedlist>
  80. <listitem><para><literal>Total package names</literal> is the number of package names found
  81. in the cache.</para>
  82. </listitem>
  83. <listitem><para><literal>Normal packages</literal> is the number of regular, ordinary package
  84. names; these are packages that bear a one-to-one correspondence between
  85. their names and the names used by other packages for them in
  86. dependencies. The majority of packages fall into this category.</para>
  87. </listitem>
  88. <listitem><para><literal>Pure virtual packages</literal> is the number of packages that exist
  89. only as a virtual package name; that is, packages only "provide" the
  90. virtual package name, and no package actually uses the name. For
  91. instance, "mail-transport-agent" in the Debian system is a
  92. pure virtual package; several packages provide "mail-transport-agent",
  93. but there is no package named "mail-transport-agent".</para>
  94. </listitem>
  95. <listitem><para><literal>Single virtual packages</literal> is the number of packages with only
  96. one package providing a particular virtual package. For example, in the
  97. Debian system, "X11-text-viewer" is a virtual package, but
  98. only one package, xless, provides "X11-text-viewer".</para>
  99. </listitem>
  100. <listitem><para><literal>Mixed virtual packages</literal> is the number of packages that either
  101. provide a particular virtual package or have the virtual package name
  102. as the package name. For instance, in the Debian system,
  103. "debconf" is both an actual package, and provided by the debconf-tiny
  104. package.</para>
  105. </listitem>
  106. <listitem><para><literal>Missing</literal> is the number of package names that were referenced in
  107. a dependency but were not provided by any package. Missing packages may
  108. be an evidence if a full distribution is not accessed, or if a package
  109. (real or virtual) has been dropped from the distribution. Usually they
  110. are referenced from Conflicts or Breaks statements.</para>
  111. </listitem>
  112. <listitem><para><literal>Total distinct</literal> versions is the number of package versions
  113. found in the cache. If more than one distribution is being accessed
  114. (for instance, "stable" and "unstable"), this value
  115. can be considerably larger than the number of total package names.</para>
  116. </listitem>
  117. <listitem><para><literal>Total dependencies</literal> is the number of dependency relationships
  118. claimed by all of the packages in the cache.</para>
  119. </listitem>
  120. </itemizedlist>
  121. </para></listitem>
  122. </varlistentry>
  123. <varlistentry><term><option>showsrc</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
  124. <listitem><para><literal>showsrc</literal> displays all the
  125. source package records that match the given package names. All
  126. versions are shown, as well as all records that declare the name
  127. to be a binary package. Use <option>--only-source</option> to
  128. display only source package names.
  129. </para></listitem>
  130. </varlistentry>
  131. <varlistentry><term><option>dump</option></term>
  132. <listitem><para><literal>dump</literal> shows a short listing of every package in the cache. It is
  133. primarily for debugging.</para></listitem>
  134. </varlistentry>
  135. <varlistentry><term><option>dumpavail</option></term>
  136. <listitem><para><literal>dumpavail</literal> prints out an available list to stdout. This is
  137. suitable for use with &dpkg; and is used by the &dselect; method.</para></listitem>
  138. </varlistentry>
  139. <varlistentry><term><option>unmet</option></term>
  140. <listitem><para><literal>unmet</literal> displays a summary of all unmet dependencies in the
  141. package cache.</para></listitem>
  142. </varlistentry>
  143. <varlistentry><term><option>show</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
  144. <listitem><para><literal>show</literal> performs a function similar to
  145. <command>dpkg --print-avail</command>; it displays the package records for the
  146. named packages.</para></listitem>
  147. </varlistentry>
  148. <varlistentry><term><option>search</option> <option><replaceable>&synopsis-regex;</replaceable>…</option></term>
  149. <listitem><para><literal>search</literal> performs a full text search on all available package
  150. lists for the POSIX regex pattern given, see &regex;.
  151. It searches the package names and the
  152. descriptions for an occurrence of the regular expression and prints out
  153. the package name and the short description, including virtual package
  154. names.
  155. If <option>--full</option> is given
  156. then output identical to <literal>show</literal> is produced for each matched
  157. package, and if <option>--names-only</option> is given then the long description
  158. is not searched, only the package name and provided packages are.</para>
  159. <para>
  160. Separate arguments can be used to specify multiple search patterns that
  161. are and'ed together.</para></listitem>
  162. </varlistentry>
  163. <varlistentry><term><option>depends</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
  164. <listitem><para><literal>depends</literal> shows a listing of each dependency a package has
  165. and all the possible other packages that can fulfill that dependency.</para></listitem>
  166. </varlistentry>
  167. <varlistentry><term><option>rdepends</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
  168. <listitem><para><literal>rdepends</literal> shows a listing of each reverse dependency a
  169. package has.</para></listitem>
  170. </varlistentry>
  171. <varlistentry><term><option>pkgnames</option> <optional><replaceable>&synopsis-prefix;</replaceable></optional></term>
  172. <listitem><para>This command prints the name of each package APT knows. The optional
  173. argument is a prefix match to filter the name list. The output is suitable
  174. for use in a shell tab complete function and the output is generated
  175. extremely quickly. This command is best used with the
  176. <option>--generate</option> option.</para>
  177. <para>Note that a package which APT knows of is not necessarily available to download,
  178. installable or installed, e.g. virtual packages are also listed in the generated list.
  179. </para></listitem>
  180. </varlistentry>
  181. <varlistentry><term><option>dotty</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
  182. <listitem><para><literal>dotty</literal> takes a list of packages on the command line and
  183. generates output suitable for use by dotty from the
  184. <ulink url="http://www.research.att.com/sw/tools/graphviz/">GraphViz</ulink>
  185. package. The result will be a set of nodes and edges representing the
  186. relationships between the packages. By default the given packages will
  187. trace out all dependent packages; this can produce a very large graph.
  188. To limit the output to only the packages listed on the command line,
  189. set the <literal>APT::Cache::GivenOnly</literal> option.</para>
  190. <para>The resulting nodes will have several shapes; normal packages are boxes,
  191. pure virtual packages are triangles, mixed virtual packages are diamonds,
  192. missing packages are hexagons. Orange boxes mean recursion was stopped
  193. (leaf packages), blue lines are pre-depends, green lines are conflicts.</para>
  194. <para>Caution, dotty cannot graph larger sets of packages.</para></listitem>
  195. </varlistentry>
  196. <varlistentry><term><option>xvcg</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
  197. <listitem><para>The same as <literal>dotty</literal>, only for xvcg from the
  198. <ulink url="http://rw4.cs.uni-sb.de/users/sander/html/gsvcg1.html">VCG tool</ulink>.
  199. </para></listitem></varlistentry>
  200. <varlistentry><term><option>policy</option> <optional><replaceable>&synopsis-pkg;</replaceable>…</optional></term>
  201. <listitem><para><literal>policy</literal> is meant to help debug issues relating to the
  202. preferences file. With no arguments it will print out the
  203. priorities of each source. Otherwise it prints out detailed information
  204. about the priority selection of the named package.</para></listitem>
  205. </varlistentry>
  206. <varlistentry><term><option>madison</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
  207. <listitem><para><literal>apt-cache</literal>'s <literal>madison</literal> command attempts to mimic
  208. the output format and a subset of the functionality of the Debian
  209. archive management tool, <literal>madison</literal>. It displays
  210. available versions of a package in a tabular format. Unlike the
  211. original <literal>madison</literal>, it can only display information for
  212. the architecture for which APT has retrieved package lists
  213. (<literal>APT::Architecture</literal>).</para></listitem>
  214. </varlistentry>
  215. </variablelist>
  216. </refsect1>
  217. <refsect1><title>options</title>
  218. &apt-cmdblurb;
  219. <variablelist>
  220. <varlistentry><term><option>-p</option></term><term><option>--pkg-cache</option></term>
  221. <listitem><para>Select the file to store the package cache. The package cache is the
  222. primary cache used by all operations.
  223. Configuration Item: <literal>Dir::Cache::pkgcache</literal>.</para></listitem>
  224. </varlistentry>
  225. <varlistentry><term><option>-s</option></term><term><option>--src-cache</option></term>
  226. <listitem><para>Select the file to store the source cache. The source is used only by
  227. <literal>gencaches</literal> and it stores a parsed version of the package
  228. information from remote sources. When building the package cache the
  229. source cache is used to avoid reparsing all of the package files.
  230. Configuration Item: <literal>Dir::Cache::srcpkgcache</literal>.</para></listitem>
  231. </varlistentry>
  232. <varlistentry><term><option>-q</option></term><term><option>--quiet</option></term>
  233. <listitem><para>Quiet; produces output suitable for logging, omitting progress indicators.
  234. More q's will produce more quietness up to a maximum of 2. You can also use
  235. <option>-q=#</option> to set the quietness level, overriding the configuration file.
  236. Configuration Item: <literal>quiet</literal>.</para></listitem>
  237. </varlistentry>
  238. <varlistentry><term><option>-i</option></term><term><option>--important</option></term>
  239. <listitem><para>Print only important dependencies; for use with <literal>unmet</literal>
  240. and <literal>depends</literal>. Causes only Depends and
  241. Pre-Depends relations to be printed.
  242. Configuration Item: <literal>APT::Cache::Important</literal>.</para></listitem>
  243. </varlistentry>
  244. <varlistentry><term><option>--no-pre-depends</option></term>
  245. <term><option>--no-depends</option></term>
  246. <term><option>--no-recommends</option></term>
  247. <term><option>--no-suggests</option></term>
  248. <term><option>--no-conflicts</option></term>
  249. <term><option>--no-breaks</option></term>
  250. <term><option>--no-replaces</option></term>
  251. <term><option>--no-enhances</option></term>
  252. <listitem><para>Per default the <command>depends</command> and
  253. <command>rdepends</command> print all dependencies. This can be tweaked with
  254. these flags which will omit the specified dependency type.
  255. Configuration Item: <literal>APT::Cache::Show<replaceable>DependencyType</replaceable></literal>
  256. e.g. <literal>APT::Cache::ShowRecommends</literal>.</para></listitem>
  257. </varlistentry>
  258. <varlistentry><term><option>--implicit</option></term>
  259. <listitem><para>Per default <command>depends</command> and <command>rdepends</command>
  260. print only dependencies explicitly expressed in the metadata. With this flag
  261. it will also show dependencies implicitly added based on the encountered data.
  262. A <literal>Conflicts: foo</literal> e.g. expresses implicitly that this package
  263. also conflicts with the package foo from any other architecture.
  264. Configuration Item: <literal>APT::Cache::ShowImplicit</literal>.
  265. </para></listitem>
  266. </varlistentry>
  267. <varlistentry><term><option>-f</option></term><term><option>--full</option></term>
  268. <listitem><para>Print full package records when searching.
  269. Configuration Item: <literal>APT::Cache::ShowFull</literal>.</para></listitem>
  270. </varlistentry>
  271. <varlistentry><term><option>-a</option></term><term><option>--all-versions</option></term>
  272. <listitem><para>Print full records for all available versions. This is the
  273. default; to turn it off, use <option>--no-all-versions</option>.
  274. If <option>--no-all-versions</option> is specified, only the candidate version
  275. will be displayed (the one which would be selected for installation).
  276. This option is only applicable to the <literal>show</literal> command.
  277. Configuration Item: <literal>APT::Cache::AllVersions</literal>.</para></listitem>
  278. </varlistentry>
  279. <varlistentry><term><option>-g</option></term><term><option>--generate</option></term>
  280. <listitem><para>Perform automatic package cache regeneration, rather than use the cache
  281. as it is. This is the default; to turn it off, use <option>--no-generate</option>.
  282. Configuration Item: <literal>APT::Cache::Generate</literal>.</para></listitem>
  283. </varlistentry>
  284. <varlistentry><term><option>--names-only</option></term><term><option>-n</option></term>
  285. <listitem><para>Only search on the package and provided package names, not the long descriptions.
  286. Configuration Item: <literal>APT::Cache::NamesOnly</literal>.</para></listitem>
  287. </varlistentry>
  288. <varlistentry><term><option>--all-names</option></term>
  289. <listitem><para>Make <literal>pkgnames</literal> print all names, including virtual packages
  290. and missing dependencies.
  291. Configuration Item: <literal>APT::Cache::AllNames</literal>.</para></listitem>
  292. </varlistentry>
  293. <varlistentry><term><option>--recurse</option></term>
  294. <listitem><para>Make <literal>depends</literal> and <literal>rdepends</literal> recursive so
  295. that all packages mentioned are printed once.
  296. Configuration Item: <literal>APT::Cache::RecurseDepends</literal>.</para></listitem>
  297. </varlistentry>
  298. <varlistentry><term><option>--installed</option></term>
  299. <listitem><para>
  300. Limit the output of <literal>depends</literal> and <literal>rdepends</literal> to
  301. packages which are currently installed.
  302. Configuration Item: <literal>APT::Cache::Installed</literal>.</para></listitem>
  303. </varlistentry>
  304. <varlistentry><term><option>--with-source</option> <option>&synopsis-param-filename;</option></term>
  305. <listitem><para>
  306. Adds the given file as a source for metadata. Can be repeated to add multiple files.
  307. Supported are currently <literal>*.deb</literal>, <literal>*.dsc</literal>,
  308. <literal>*.changes</literal>, <literal>Sources</literal> and
  309. <literal>Packages</literal> files as well as source package directories.
  310. Files are matched based on their name only, not their content!</para>
  311. <para><literal>Sources</literal> and <literal>Packages</literal> can be compressed in any
  312. format apt supports as long as they have the correct extension. If you need to store
  313. multiple of these files in one directory you can prefix a name of your choice with the
  314. last character being an underscore ("<literal>_</literal>"). Example: my.example_Packages.xz</para>
  315. <para>Note that these sources are treated as trusted (see &apt-secure;).
  316. Configuration Item: <literal>APT::Sources::With</literal>.</para></listitem>
  317. </varlistentry>
  318. &apt-commonoptions;
  319. </variablelist>
  320. </refsect1>
  321. <refsect1><title>Files</title>
  322. <variablelist>
  323. &file-sourceslist;
  324. &file-statelists;
  325. </variablelist>
  326. </refsect1>
  327. <refsect1><title>See Also</title>
  328. <para>&apt-conf;, &sources-list;, &apt-get;
  329. </para>
  330. </refsect1>
  331. <refsect1><title>Diagnostics</title>
  332. <para><command>apt-cache</command> returns zero on normal operation, decimal 100 on error.
  333. </para>
  334. </refsect1>
  335. &manbugs;
  336. </refentry>