← 返回命令列表

Linux command

apt-cache 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Search

apt-cache search [query]

Search

apt-cache search --names-only [query]

Example

apt-cache show [package]

Example

apt-cache policy [package]

Example

apt-cache depends [package]

Example

apt-cache rdepends [package]

Example

apt-cache madison [package]

说明

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.

参数

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

FAQ

What is the apt-cache command used for?

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.

How do I run a basic apt-cache example?

Run `apt-cache search [query]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does search _regex_ do in apt-cache?

Search for packages matching the POSIX regex in names and descriptions