Apt cache is a command line tool that queries and displays available information about packages from local apt files. Package information includes the package name, description, version, dependencies, repository, and maintainer.
The local apt files that store the copy from the Debian mirror are located in / var / lib / apt / lists /. This file is updated every time the apt update command is run. That way, when someone is looking for packages, the system doesn’t have to go through the various networks to get Debian mirrors.
The source of information depends on the repository listed in the /etc/apt/sources.list file and the third-party repository located in the /etc/apt/sources.list.d directory.
Apt cache is often used to search for packages. In this tutorial, we will learn how to use the apt-cache command to Find packages.
Apt cache search package
01. Keyword based package search
To search for a package by keyword, use
For example, to find out about the package
vsftpd, would be the order.
$ apt-cache search vsftpd
02. To find all packages that start with a specific string.
For example, to list all packages that start with
vsftpd, you could use with
$ apt-cache pkgnames vsftpd
03 To get the exact package name
To get the exact package, use apt-cache search with
$ apt-cache search --names-only vsftpd
04. Get the list of all available packages from the apt repository.
$ apt-cache pkgnames
You can use the grep command to filter a specific package from the list.
$ apt-cache pkgnames | grep vsftpd
05. Lists all available packages along with a one-line description of the package.
$ apt-cache search .
06. Show the header of the specific package available
To check package information like package name, architecture, version, installed size, maintainer, integrity check, description usage
ie. apt-cache show
$ apt-cache show docker
Apt search, apt show, aptitude search, aptitude show do the same thing, but the output text format may vary.
Apt-cache comes with the basic installation in the Debian / Ubuntu family. I hope this tutorial helped you find the packages in Debian / Ubuntu distributions.