LFCS User and Group Management Practice Question
An administrator needs to delete user 'obsolete' and remove its home directory and mail spool. Which command should be used?
⚠ Common exam trap
Test-takers frequently confuse the `-r` flag with the `-f` flag, assuming `-f` (force) also removes files, or they may think `userdel` alone is sufficient, missing the requirement to clean up the home directory and mail spool.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
userdel -r obsolete
The correct command is `userdel -r obsolete` because the `-r` flag removes the user's home directory and mail spool in addition to deleting the user account. This matches the requirement to delete the user 'obsolete' along with its home directory and mail spool, as specified in the question.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
userdel -f obsolete
Why it's wrong here
The -f flag forces deletion even when the user is still logged in or owns running processes; it does not remove the home directory or mail spool. It is tempting as the aggressive removal option, but the required behaviour comes from userdel -r, which deletes the account plus home directory and mail spool.
- ✓
userdel -r obsolete
Why this is correct
The -r flag instructs userdel to remove the account together with its home directory and mail spool. Without -r, those files persist as orphans, so this satisfies the stem's explicit requirement to delete both the user and associated data.
- ✗
userdel obsolete
Why it's wrong here
Plain userdel removes only the account entry from /etc/passwd, /etc/shadow and /etc/group, leaving the home directory and mail spool intact. It is tempting because it deletes the user, but the stem also demands directory and spool removal. The -r flag performs that additional deletion.
- ✗
groupdel obsolete
Why it's wrong here
groupdel removes a group entry, not a user account, so it cannot delete user 'obsolete' or their files. It is tempting because it is a deletion command operating on /etc/group, but the target is a user. userdel -r is required to remove the account, home directory and mail spool.
Go deeper
Related to this question
About these practice questions
This LFCS question is part of Courseiva's 406-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LFCS practice question is part of Courseiva's free Linux Foundation certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LFCS exam.