
The apt-cache tool
The apt-cache tool is used to check for packages that are available in the local system. Search, dependency, and reverse dependency can be checked with the help of the apt-cache tool.
Searching for a package with the apt-cache search command
Use the following command to search for a package. Here, we are searching for the apache2-bin package using the apt-cache
command with the search
option:
sudo apt-cache search apache2-bin
As we can see in the following screenshot, the preceding command lists out the package and a short description:

If you want to check the dependencies for a particular package, then use the depends
option with the apt-cache tool. The command is as follows:
sudo apt-cache depends apache2
The output is shown in the following screenshot:

The other way is also supported. If you need to check what packages are dependent on a particular package, then use the following command:
sudo apt-cache rdepends ssl-cert
The output is shown in the following screenshot:

An important point to remember is to run the apt-get update
command before doing any of the dependency checks. It's time we learn about another package management tool, aptitude.