Search the local APT indexes for package candidates whose name or description contains web server.
Do not install anything.
Which command is appropriate?
apt-cache search searches the downloaded APT indexes for matching package names and descriptions without changing the system.
Detailed explanation
apt-get search 'web server'Incorrect. apt-get has no search subcommand for this operation.
Incorrect. apt-get has no search subcommand for this operation.
dpkg -S 'web server'Incorrect. dpkg -S searches ownership of installed files, not repository descriptions.
Incorrect. dpkg -S searches ownership of installed files, not repository descriptions.
apt-cache search 'web server'Correct. apt-cache search 'web server' searches names and descriptions in the indexes.
Correct. apt-cache search 'web server' searches names and descriptions in the indexes.
dpkg -L 'web server'Incorrect. dpkg -L expects a package name and lists its files.
Incorrect. dpkg -L expects a package name and lists its files.
Try it yourself
An example you can run in a temporary verification environment.
apt-cache search '^bash$' | headExpected result
bashパッケージの検索結果(索引が利用可能な環境)Key points
- search finds candidates
- The local index is queried
- No installation occurs
Notes
- Environment: Debian系 / 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.