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. apt-cache policy nginx shows installed and candidate versions and priorities.
apt-cache depends nginxIncorrect. depends lists dependency relationships.
Incorrect. depends lists dependency relationships.
apt-cache search nginxIncorrect. search finds matching package names and descriptions.
Incorrect. search finds matching package names and descriptions.
apt-file search nginxIncorrect. apt-file search finds packages providing a path.
Incorrect. apt-file search finds packages providing a path.
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 / ローカルキャッシュ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.