← Back to home

apt-cache policy: Peeking at Debian's Package Desires Before You Commit

June 21, 2026

There are moments in Debian life when simple desire is not enough. You do not merely want a package. You want to know which version Debian is courting, which archive it prefers, and whether the candidate it has chosen is truly the one you want to take home. That is where apt-cache policy steps in, draped in confidence and holding the answer like a velvet dossier.

This command is the package-manager equivalent of asking the archive to be honest with you. It tells you the installed version, the candidate version, and the priority of every available source. In other words: it shows you the power dynamics before you make a move. Very sexy. Very practical. Very Debian.

Use it when you are comparing stable, testing, backports, or a pinned repository that keeps trying to make eye contact. If apt-cache search is browsing the menu, apt-cache policy is checking the chef, the ingredients, and the reputation of the kitchen before you decide what happens next.

Examples

1. See the candidate version for a package:

apt-cache policy neovim

This shows the installed version, the version Debian would install next, and the repositories offering each one. It is the cleanest way to see what version is waiting in the wings.

2. Inspect where a package version is coming from:

apt-cache policy curl

This reveals which archive is supplying the current candidate. If you have mixed repositories or backports in play, this is where the truth comes out under good lighting.

3. Review priorities across all configured repositories:

apt-cache policy

Run it with no package name to see the full policy table. The output can be gloriously verbose, but it tells you exactly how Debian decides which source gets picked when multiple options are present.

4. Pair it with a pager for long, luxurious output:

apt-cache policy | less

When the repository landscape gets sprawling, a pager makes the whole experience easier to navigate. Debian is not afraid of detail, and neither should you be.

5. Focus on a package you expect to pin or override:

apt-cache policy chromium

If you are pinning packages, chasing backports, or testing a custom repository, this command shows whether your preferred version is actually winning the tug-of-war.

Why it feels so Debian

apt-cache policy is not interested in drama. It does not install anything, remove anything, or flatter you with animation. It simply tells you the rules of the room: which version is installed, which one is preferred, and why. That kind of transparency is pure Debian seduction — calm, rigorous, and a little bit obsessive in the best possible way.

And that is the charm. Debian does not want you guessing. It wants you informed, deliberate, and maybe just a little bit turned on by package priorities. With apt-cache policy, you do not have to wonder what the system will choose. You already know. You just have to decide whether to let it.