How do you delete a user and their home directory?

QuestionsQuestions4 SkillsProDec, 14 2025
0380

You've asked a great follow-up question! Deleting a user and their home directory is also quite straightforward.

To delete a user and remove their home directory (and mail spool), you can use the userdel command with the -r option.

Here's the command you would use:

sudo userdel -r username

Replace username with the actual username you want to delete (e.g., bob or joker from the previous steps).

  • userdel: This is the command used to delete a user account.
  • -r (or --remove): This option tells userdel to remove the user's home directory and mail spool, effectively cleaning up all associated files.

Important Note: Always be careful when deleting user accounts, especially with the -r option, as it permanently removes their data. Only delete accounts if you are absolutely sure they are no longer needed.

Let me know if you'd like to try deleting one of the users you created!

0 Comments

no data
Be the first to share your comment!