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 removes the package but normally retains conffiles.
dpkg -s toolIncorrect. -s displays package status.
Incorrect. -s displays package status.
dpkg -P toolCorrect. dpkg -P tool purges the package and its conffiles.
Correct. dpkg -P tool purges the package and its conffiles.
dpkg -l toolIncorrect. -l displays a status list.
Incorrect. -l displays a status list.
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以降 / ヘルプ表示のみ
- 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.