Remove the installed nginx package.
Keep package-managed configuration files for a possible reinstall.
Which command is appropriate?
apt remove removes the package but normally leaves its package-managed configuration files. purge removes those files too.
Detailed explanation
apt install nginxIncorrect. apt install installs or updates nginx.
Incorrect. install adds or reinstalls a package.
apt purge nginxIncorrect. purge removes package-managed configuration as well.
Incorrect. purge removes the configuration that the requirement says to retain.
apt remove nginxCorrect. apt remove nginx removes the package while normally retaining configuration.
Correct. remove deletes the package while normally preserving its conffiles.
apt autoremove nginxIncorrect. autoremove mainly cleans automatically installed dependencies that are no longer needed.
Incorrect. autoremove targets no-longer-needed automatic dependencies.
Try it yourself
An example you can run in a temporary verification environment.
apt-get --help | grep -E 'remove|purge'Expected result
removeとpurgeが別の操作として表示されるKey points
- remove keeps configuration
- purge removes configuration
- User data is managed separately
Notes
- Environment: APT 2.x / ヘルプ表示のみ
- Use a disposable environment or simulation before package changes.
- APT behavior can vary with repository configuration and package-manager version.
Foundation review
Place the operation
remove and purge differ mainly in how tracked configuration is handled; application-created data may require separate cleanup.
Check the side effect
Inspect package status after remove and purge in a disposable package test.