For nginx, inspect the installed version, candidate version, versions from sources, and their priorities.
Investigate version selection rather than dependencies.
Which command is appropriate?
apt-cache policy displays Installed, Candidate, and the version table with source priorities.
Detailed explanation
apt-cache policy nginxCorrect. apt-cache policy nginx shows installed and candidate versions and priorities.
Correct. policy shows Installed, Candidate, and the version table.
apt-cache depends nginxIncorrect. depends lists dependency relationships.
Incorrect. depends lists required packages, not version priorities.
apt-cache search nginxIncorrect. search finds matching package names and descriptions.
Incorrect. search returns matching names or descriptions.
apt-file search nginxIncorrect. apt-file search finds packages providing a path.
Incorrect. apt-file search maps file paths to packages.
Try it yourself
An example you can run in a temporary verification environment.
apt-cache policy aptExpected result
Installed、Candidate、Version tableを含む表示Key points
- policy explains version selection
- Candidate is the install choice
- Priorities affect selection
Notes
- Environment: APT 2.x / ローカルキャッシュ
- Use a disposable environment or simulation before package changes.
- APT behavior can vary with repository configuration and package-manager version.
Foundation review
Place the operation
Policy output explains why a particular repository version is selected; dependency queries answer a different question.
Check the side effect
Review the version table before changing repository pins.