LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

apt-cache

Query the APT package cache

TLDR

Search package names and descriptions
$ apt-cache search [keyword]
copy
Restrict the search to names only
$ apt-cache search --names-only [keyword]
copy
Show a package's record
$ apt-cache show [package]
copy
Show which versions are available and which is installed
$ apt-cache policy [package]
copy
Show the versions each repository offers
$ apt-cache madison [package]
copy
Show what a package depends on
$ apt-cache depends [package]
copy
Show only the hard dependencies, skipping suggests and recommends
$ apt-cache depends --important [package]
copy
Show what depends on a package
$ apt-cache rdepends [package]
copy
Limit reverse dependencies to installed packages
$ apt-cache rdepends --installed [package]
copy
Show the raw record, including providers and reverse dependencies
$ apt-cache showpkg [package]
copy
List every package name starting with a prefix
$ apt-cache pkgnames [prefix]
copy
Report unmet dependencies in the cache
$ apt-cache unmet
copy
Summarize the cache itself
$ apt-cache stats
copy

SYNOPSIS

apt-cache [options] command [arguments]

DESCRIPTION

apt-cache queries the local APT package cache to search for packages, display detailed package information, and analyze dependency relationships. It reads the package index files downloaded by apt update and provides fast, offline access to package metadata without contacting remote repositories.Common operations include searching for packages by name or description, inspecting version and dependency details, checking installation policies, and listing reverse dependencies. The output is suitable for scripting and can help diagnose dependency conflicts or determine which repository provides a given package.

PARAMETERS

search regex

Search for packages matching the POSIX regex in names and descriptions
show package
Show detailed package record for a package
showpkg package
Show general information including versions and dependencies
showsrc package
Show all source package records for a package
policy [package]
Show policy settings, installation status, and repository priorities
depends package
Show dependencies for a package
rdepends package
Show reverse dependencies (packages that depend on this one)
madison package
Show available versions in a tabular format
pkgnames [prefix]
List all package names in the cache, optionally filtered by prefix
stats
Show cache statistics
dump
Show a short listing of every package in the cache
unmet
Show a summary of all unmet dependencies in the cache
-f, --full
Print full package records when searching
-n, --names-only
Only search package names, not descriptions
-i, --important
Print only Depends and Pre-Depends relations (for use with depends and unmet)
--installed
Limit output to currently installed packages
--recurse
Make depends and rdepends recursive

CONFIGURATION

/etc/apt/sources.list

Main file listing configured package repositories.
/etc/apt/sources.list.d/
Directory for additional repository source files.
/etc/apt/preferences.d/
Directory for package pinning and priority preferences.

INSTALL

sudo apt install apt
copy
sudo dnf install apt
copy
sudo pacman -S apt
copy
sudo apk add apt
copy
brew install apt
copy
nix profile install nixpkgs#apt
copy

CAVEATS

This tool operates on the local cache; run apt update first to ensure the cache is current.

HISTORY

Part of the APT (Advanced Package Tool) suite developed for Debian-based systems in the late 1990s.

SEE ALSO

apt(8), apt-get(8), aptitude(8), dpkg(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid