Completely remove the installed package example.
Include dpkg-managed configuration files in the removal.
Which command is appropriate?
dpkg -P purges the package and its dpkg-managed configuration files. It does not mean that every user-created data file is automatically removed.
Detailed explanation
dpkg -r exampleIncorrect. -r removes the package but normally keeps configuration files.
Incorrect. -r removes the package but normally keeps configuration files.
dpkg -l exampleIncorrect. -l lists package status.
Incorrect. -l lists package status.
dpkg -P exampleCorrect. dpkg -P purges the package and its managed configuration.
Correct. dpkg -P purges the package and its managed configuration.
dpkg -C exampleIncorrect. -C reports partially installed packages.
Incorrect. -C reports partially installed packages.
Try it yourself
An example you can run in a temporary verification environment.
dpkg --help | grep -E -- '--purge|-P' | head -n 1Expected result
purge操作の説明。実際の削除は行わないKey points
- -P means purge
- Configuration files are included
- User data is a separate concern
Notes
- Environment: Debian系 / dpkg 1.22以降
- 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.