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. apt install installs or updates nginx.
apt purge nginxIncorrect. purge removes package-managed configuration as well.
Incorrect. purge removes package-managed configuration as well.
apt remove nginxCorrect. apt remove nginx removes the package while normally retaining configuration.
Correct. apt remove nginx removes the package while normally retaining configuration.
apt autoremove nginxIncorrect. autoremove mainly cleans automatically installed dependencies that are no longer needed.
Incorrect. autoremove mainly cleans automatically installed dependencies that are no longer needed.
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 / ヘルプ表示のみ
- 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.