Which command deletes a Linux user account and its home directory?

Prepare for the TestOut Labs Test. Interactive quizzes and flashcards with insights and tips for a comprehensive review. Ace your exam!

Multiple Choice

Which command deletes a Linux user account and its home directory?

Explanation:
Deleting a Linux user and their home directory requires a command that handles both removing the account entry and cleaning up the user’s files. The command that does this is userdel -r username. The -r option tells the system to remove the user’s home directory and mail spool in addition to deleting the account, so there are no leftover files owned by that user. Other options don’t fulfill both parts in one step. Deluser might remove the account on some systems, but without a flag like --remove-home it may leave the home directory behind. A non-existent command isn’t a valid way to perform the task. And simply deleting the home directory with rm -rf removes files but does not remove the user account from the system records, which can lead to orphaned entries and login issues.

Deleting a Linux user and their home directory requires a command that handles both removing the account entry and cleaning up the user’s files. The command that does this is userdel -r username. The -r option tells the system to remove the user’s home directory and mail spool in addition to deleting the account, so there are no leftover files owned by that user.

Other options don’t fulfill both parts in one step. Deluser might remove the account on some systems, but without a flag like --remove-home it may leave the home directory behind. A non-existent command isn’t a valid way to perform the task. And simply deleting the home directory with rm -rf removes files but does not remove the user account from the system records, which can lead to orphaned entries and login issues.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy