Forrest logo
back to the apt-cache tool

apt-cache:tldr:9ec33

apt-cache: Show whether a package is installed and up to date.
$ apt-cache policy ${package}
try on your machine

The command apt-cache policy ${package} is used in a Linux terminal to display the installed and available versions of a package along with the source repositories.

Here's the breakdown of the command components:

  • apt-cache refers to the APT package-handling utility that allows users to interact with the local package cache.
  • policy is a subcommand of apt-cache which provides information about package versions and repositories.
  • ${package} is a placeholder for the name of the package you want to get information about.

When you run this command, it will display output similar to the following:

package:
  Installed: (none)
  Candidate: 1.2.3-4ubuntu1
  Version table:
     1.2.3-4ubuntu1 500
        500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages

In the output:

  • Installed indicates the currently installed version (in this case, it's (none) which means the package is not installed).
  • Candidate refers to the latest version available for installation from the enabled repositories.
  • Version table provides information about various available versions and the repositories they belong to.

The numbers in the output represent the priority of the repositories. In the example, the version 1.2.3-4ubuntu1 can be installed from the repository at http://archive.ubuntu.com/ubuntu with a priority of 500.

This command is useful for checking the available versions of a package and the repositories from which they can be installed.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the apt-cache tool