Remove the installed nginx package with APT.
Keep its package configuration files by using remove rather than purge.
Which command is appropriate?
apt-get remove removes the package while retaining configuration files. apt-get purge requests removal of those files as well.
Detailed explanation
apt-get purge nginxIncorrect. purge requests removal of the package's configuration files too.
Incorrect. purge requests removal of the package's configuration files too.
apt-get remove nginxCorrect. apt-get remove nginx removes nginx while normally keeping its configuration.
Correct. apt-get remove nginx removes nginx while normally keeping its configuration.
apt-cache remove nginxIncorrect. apt-cache is for querying package indexes.
Incorrect. apt-cache is for querying package indexes.
apt-get clean nginxIncorrect. apt-get clean removes cached archives and does not take a package name here.
Incorrect. apt-get clean removes cached archives and does not take a package name here.
Try it yourself
An example you can run in a temporary verification environment.
apt-get --help | grep -E '^ remove'Expected result
removeサブコマンドの説明。実際の削除は行わないKey points
- remove keeps configuration
- purge is different
- Review dependent packages before removal
Notes
- Environment: Debian系 / 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.