You have been tasked with deleting a user account on a Linux server, and you must ensure that the user's home directory and mail spool is also removed. Which command should you execute?
The correct command is userdel -r username. The -r option removes the user's home directory and mail spool along with the user account itself. Without the -r option, the account will be deleted, but the home directory and mail spool would remain on the system. The usermod command is for modifying an existing user account, not deleting it. The deluser command does not exist by default in most Linux distributions, and userdel --remove-all-files is incorrect because the --remove-all-files option is not a valid option for the userdel command.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the '-r' option do in the 'userdel' command?
Open an interactive chat with Bash
What is the difference between 'userdel' and 'usermod' commands?
Open an interactive chat with Bash
Why doesn't 'deluser' exist by default on most Linux distributions?