Find which package contains /usr/bin/example-tool.
Include packages that are not currently installed.
Which command is appropriate?
apt-file search queries repository Contents indexes by path, so it can find providers even when the package is not installed.
Detailed explanation
apt-file list /usr/bin/example-toolIncorrect. apt-file list starts with a package name and lists its paths.
Incorrect. apt-file list starts with a package name and lists its paths.
apt-file search /usr/bin/example-toolCorrect. apt-file search /usr/bin/example-tool finds packages providing the path.
Correct. apt-file search /usr/bin/example-tool finds packages providing the path.
apt-cache depends /usr/bin/example-toolIncorrect. apt-cache depends handles package relationships, not file providers.
Incorrect. apt-cache depends handles package relationships, not file providers.
apt show /usr/bin/example-toolIncorrect. apt show expects a package name and does not reverse-lookup a path.
Incorrect. apt show expects a package name and does not reverse-lookup a path.
Try it yourself
An example you can run in a temporary verification environment.
apt-file search /usr/bin/example-toolExpected result
該当すれば「パッケージ名: パス」の形式。apt-fileとContents索引が必要Key points
- search reverses path to package
- It can find uninstalled packages
- Contents indexes are used
Notes
- Environment: apt-file 3.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.