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.
dpkg -r toolCorrect. dpkg -r tool removes the package while retaining conffiles.
Correct. -r removes the package and normally retains its conffiles.
dpkg -P toolIncorrect. -P removes the package and conffiles.
Incorrect. -P removes the configuration too.
dpkg -l toolIncorrect. -l displays status and changes nothing.
Incorrect. -l only displays package state.
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以降 / ヘルプ表示のみ
- Use a disposable package or read-only help when testing package commands.
- Package behavior can vary with dpkg and debconf versions.
Foundation review
Place the operation
The distinction between remove and purge is the treatment of tracked configuration, not whether the package files are removed.
Check the side effect
Inspect the package status and conffiles after a disposable removal test.