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