Which command allows you to remove a user along with their home directory?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

The command that allows you to remove a user along with their home directory is "userdel -r." The "-r" option specifically tells the system to remove the user's home directory and the user's mail spool along with the account. This is particularly useful for ensuring that no residual files are left on the system after a user account has been deleted, thus keeping the filesystem clean and organized.

In contrast, the other options are not suited for this purpose. The option "-f" with the userdel command forces the removal of the user account, but it does not include the deletion of the home directory. The "-d" option is not a standard because no such flag exists for userdel; it would not function as intended. Lastly, "usermod -r" is incorrect because usermod is primarily used for modifying existing user accounts rather than deleting them. Thus, the option for removing both the user and the associated home directory is confidently identified as "userdel -r."

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy