How to delete a user account?

QuestionsQuestions8 SkillsProUser Account ManagementOct, 04 2025
082

To delete a user account in Linux, you can use the userdel command. Here’s how to do it:

Basic Command

To delete a user account without removing their home directory:

sudo userdel username

Delete User and Home Directory

To delete the user account and also remove their home directory and mail spool, use the -r option:

sudo userdel -r username

Example

If you want to delete a user named alice and their home directory, you would run:

sudo userdel -r alice

Important Note

Make sure you have administrative privileges to execute these commands, and be cautious when deleting user accounts, especially in production environments, as this action is irreversible.

0 Comments

no data
Be the first to share your comment!