Remove the installed package example.
Keep dpkg-managed configuration files for a possible later reinstall.
Which command is appropriate?
dpkg -r removes the package while preserving configuration files such as conffiles. This differs from purge.
Detailed explanation
dpkg -P exampleIncorrect. -P purges the package and its managed configuration files.
Incorrect. -P purges the package and its managed configuration files.
dpkg -r exampleCorrect. dpkg -r removes the package but keeps its configuration files.
Correct. dpkg -r removes the package but keeps its configuration files.
dpkg -i exampleIncorrect. -i installs a deb archive.
Incorrect. -i installs a deb archive.
dpkg -V exampleIncorrect. -V verifies package files rather than removing the package.
Incorrect. -V verifies package files rather than removing the package.
Try it yourself
An example you can run in a temporary verification environment.
dpkg --help | grep -E -- '--remove|-r' | head -n 1Expected result
remove操作の説明。実際の削除は行わないKey points
- remove keeps configuration
- The argument is a package name
- Compare remove with purge
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.