Remove the installed package tool with dpkg.
Keep configuration files managed as conffiles.
Which command is appropriate?
dpkg -r PACKAGE removes the package and normally keeps its conffiles, unlike -P.
Detailed explanation
dpkg -i toolIncorrect. -i installs a deb archive.
Incorrect. -i installs a deb archive.
dpkg -r toolCorrect. dpkg -r tool removes the package while retaining conffiles.
Correct. dpkg -r tool removes the package while retaining conffiles.
dpkg -P toolIncorrect. -P removes the package and conffiles.
Incorrect. -P removes the package and conffiles.
dpkg -l toolIncorrect. -l displays status and changes nothing.
Incorrect. -l displays status and changes nothing.
Try it yourself
An example you can run in a temporary verification environment.
dpkg --help | grep -E -- '--remove|-r' | head -n 1Expected result
--remove | -r package...に相当する説明Key points
- -r removes a package
- Configuration is kept
- -P purges configuration
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.