Display package desired state, current state, name, and version from the dpkg database.
Do not change system state.
Which command is appropriate?
dpkg -l prints package selection and status in a compact table. A leading ii is one example of an installed state.
Detailed explanation
dpkg -iIncorrect. -i installs a deb archive.
Incorrect. -i installs a deb archive.
dpkg -rIncorrect. -r removes a package.
Incorrect. -r removes a package.
dpkg -sIncorrect. -s shows a detailed record for a specified package.
Incorrect. -s shows a detailed record for a specified package.
dpkg -lCorrect. dpkg -l prints the package status table.
Correct. dpkg -l prints the package status table.
Try it yourself
An example you can run in a temporary verification environment.
dpkg -l | sed -n '1,8p'Expected result
Desired、Status、Name、Version、Architecture等の見出しとパッケージ行Key points
- -l lists packages
- ii is an installed-state example
- The operation is read-only
Notes
- Environment: dpkg 1.21以降 / ローカルデータベース
- 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.