Apt-cache – search for software packages

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 search Flag.

For example, to find out about the package vsftpd, would be the order.

$ apt-cache search vsftpd

apt-cache serach vsftpd package
apt-cache serach vsftpd package

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 pkgnames flag.

$ apt-cache pkgnames vsftpd

apt-cache list package starting with vsftpd
apt-cache list package starting with vsftpd

03 To get the exact package name

To get the exact package, use apt-cache search with --names-only Opportunity.

For example,

$ apt-cache search --names-only vsftpd

apt-cache only gets the name search from a package
apt-cache only gets the name search from a package

04. Get the list of all available packages from the apt repository.

$ apt-cache pkgnames

apt-cache pkgnames output
apt-cache pkgnames – list all packages

You can use the grep command to filter a specific package from the list.

For example

$ apt-cache pkgnames | grep vsftpd

05. Lists all available packages along with a one-line description of the package.

$ apt-cache search .

apt-cache search – list all packages with online description

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 show Flag.

ie. apt-cache show displayed the package metadata.

For example

$ apt-cache show docker

apt-cache shows the Docker package in detail
apt-cache Show package information in detail


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.