Remove the installed package tool with dpkg.
Also remove configuration files managed as conffiles.
Which command is appropriate?
dpkg -P PACKAGE performs a purge, removing the package and its managed configuration files.
Detailed explanation
dpkg -r toolIncorrect. -r removes the package but normally retains conffiles.
Incorrect. -r normally leaves conffiles.
dpkg -s toolIncorrect. -s displays package status.
Incorrect. -s reads status and changes nothing.
dpkg -P toolCorrect. dpkg -P tool purges the package and its conffiles.
Correct. -P removes the package and managed configuration.
dpkg -l toolIncorrect. -l displays a status list.
Incorrect. -l lists state only.
Try it yourself
An example you can run in a temporary verification environment.
dpkg --help | grep -E -- '--purge|-P' | head -n 1Expected result
--purge | -P package...に相当する説明Key points
- -P means purge
- Configuration is removed
- User data is not automatically included
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
Purge is stronger than remove for conffiles, but it does not necessarily remove application data outside package ownership.
Check the side effect
Review the package-owned files before confirming a purge.