Delete obsolete user retired.
Also remove the user's home directory and mail spool.
Which command is appropriate?
userdel -r removes the account, home directory, and mail spool. Check backups and ownership before destructive removal.
Detailed explanation
userdel retiredIncorrect. Without -r, the home and mail spool normally remain.
Incorrect. Without -r, the home and mail spool normally remain.
userdel -r retiredCorrect. -r requests removal of the home directory and mail spool.
Correct. -r requests removal of the home directory and mail spool.
usermod -r retiredIncorrect. usermod changes an account rather than deleting it.
Incorrect. usermod changes an account rather than deleting it.
groupdel retiredIncorrect. groupdel removes a group, not a user account.
Incorrect. groupdel removes a group, not a user account.
Try it yourself
An example you can run in a temporary verification environment.
userdel --help | grep -E -- '-r,|--remove'Expected result
ホームとメールスプールの削除を示す説明行Key points
- userdel removes the account
- -r removes related data
- Verify backups first
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.