apt-cache command

The APT suite of tools includes a command called apt-cache whose purpose is to provide information about the Debian package database. Information are gathered during the apt-get update operation from the sources listed in the sources.list file.

In this lesson we will describe some features of this command.

Search for a program

Let’s say you would like to install a network mapper, but you don’t know the exact name of the program. You could type apt-cache search network mapper to get a list of packages that contain the words network mapper in their name or description:

apt-cache search for a program

Display Package Information

To display information about a particural package, use the apt-cache showpkg PACKAGE_NAME command:

apt-cache showpkg

Display Package Statistics

To learn how many packages are installed, how many dependencies are recorded, and various other statistics about the package database, use the apt-cache stats command:

apt-cache stats

Find Unmet Dependencies

To display information about unmet dependencies, use the apt-cache unmet command. This command displays a summary of all unmet dependencies in the package cache.

Display Dependencies

To show all of the specified package’s dependencies, use the apt-cache depends PACKAGE_NAME command:

apt-cache depends

To find reverse dependencies (packages that depend on the one you specify), use the rdepends subcommand.

 

Locate All Packages

To display the names of all the packages installed on the system, use the apt-cache pkgnames command. You can specify the second parameter to filter the name list. For example, to find all packages that begin with the string doc, we would use the following command:

apt-cache pkgnames

Geek University 2022