apt-cache queries the package cache of the APT (advanced packaging tool), which is common on Linux systems such as Debian and Ubuntu. Most commonly, this is used to search for packages and package names.

It’s also useful for helping you keep track of software dependencies.

Description

apt-cache performs a variety of operations on APT’s package cache. apt-cache does not manipulate the state of the system but does provide operations to search and generate interesting output from the package metadata.

  • Description
  • Syntax
  • Examples
  • Related commands
  • Linux commands help

Syntax

apt-cache [-agipns] [-o=config_string] [-c=config_file] {gencaches | showpkg pkg… | showsrc pkg… | stats | dump | dumpavail | unmet | search regex… | show pkg [{=pkg_version_number | /target_release}]… | depends pkg [{=pkg_version_number | /target_release}]… | rdepends pkg [{=pkg_version_number | /target_release}]… | pkgnames [prefix] | dotty pkg [{=pkg_version_number | /target_release}]… | xvcg pkg [{=pkg_version_number | /target_release}]… | policy [pkg…] | madison pkg… | {-v | –version} | {-h | –help}}

Commands

Options

All command line options may be set using the configuration file, the descriptions indicate the configuration option to set. For boolean options you can override the config file using something like -f-,–no-f, -f=no or other variations.

Package: libreadline2Versions: 2.1-12(/var/state/apt/lists/foo_Packages),Reverse Depends:libreadlineg2,libreadline2libreadline2-altdev,libreadline2Dependencies:2.1-12 - libc5 (2 5.4.0-0) ncurses3.0 (0 (null))Provides:2.1-12 -Reverse Provides:

  • Total package names is the number of package names found in the cache.Normal packages is the number of regular, ordinary package names that bear a one-to-one correspondence between their names and the names used by other packages for them in dependencies. The majority of packages fall into this category.Pure virtual packages is the number of packages that exist only as a virtual package name; that is, packages only “provide” the virtual package name, and no package actually uses the name. For instance, “mail-transport-agent” in the Debian system is a pure virtual package; several packages provide “mail-transport-agent”, but there is no package named “mail-transport-agent”.Single virtual packages is the number of packages with only one package providing a particular virtual package. For example, in the Debian system, “X11-text-viewer” is a virtual package, but only one package, xless, provides “X11-text-viewer”.Mixed virtual packages is the number of packages that either provide a particular virtual package or have the virtual package name as the package name. For instance, in the Debian system, “debconf” is both an actual package, and provided by the debconf-tiny package.Missing is the number of package names that were referenced in a dependency but were not provided by any package. Missing packages may be an evidence if a full distribution is not accessed, or if a package (real or virtual) is dropped from the distribution. Usually they are referenced from Conflicts or Breaks statements.Total distinct versions is the number of package versions found in the cache; this value is therefore at least equal to the number of total package names. If more than one distribution is being accessed (for instance, “stable” and “unstable”), this value can be considerably larger than the number of total package names.Total dependencies is the number of dependency relationships claimed by all of the packages in the cache.

Files

Examples

apt-cache search opengl

Search the APT repositories for a package with the text opengl in the name or description.

apt — A unified APT front end for the command line.apt-file — Search for individual files in all available APT packages.apt-get — Command line tool for managing APT software packages.apt-mark — Change or view the settings of individual APT packages.aptitude — Text-based front end for the APT package management system.dpkg — Install, remove, and maintain Debian software packages.