Delete alice's account, home directory, and mail spool.
Which command is appropriate?
userdel -r removes the account and requests removal of the home and mail spool; other owned files need a separate inventory.
Detailed explanation
userdel aliceIncorrect. Without -r, the home and spool are normally left behind.
Incorrect. Without -r, the home and spool are normally left behind.
usermod -r aliceIncorrect. usermod modifies an account rather than deleting it.
Incorrect. usermod modifies an account rather than deleting it.
groupdel aliceIncorrect. groupdel deletes a group, not a user account.
Incorrect. groupdel deletes a group, not a user account.
userdel -r aliceCorrect. -r includes home and mail-spool removal.
Correct. -r includes home and mail-spool removal.
Try it yourself
An example you can run in a temporary verification environment.
userdel --help 2>&1 | grep -E -- '--remove|-r,' | head -n 1Expected result
-rまたは--removeの説明Key points
- userdel removes account
- -r removes home and spool
- Other owned files may remain
Notes
- Environment: shadow-utils userdel / help読取のみ
- 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.