How to delete user account using Linux userdel command

The Linux userdel command is a very simple command. It just did what the name says, delete user. View the manual page and you can see that, in Slackware synopsis, userdel command has only one option:

SYNOPSIS
userdel [-r] login

DESCRIPTION
The userdel command modifies the system account files,
deleting all entries that refer to login. The named user
must exist. The options which apply to the userdel com-
mand are:

-r Files in the user's home directory will be removed
along with the home directory itself and the user's
mail spool. Files located in other file systems
will have to be searched for and deleted manually.

The -r option when used with userdel command will removed user's home directory and the mail spool. If there are other files in other directory, you have to remove them manually.

Let's practice using this command now. We are going to delete the user account we created just now, karim user account. As you can see from the manual above, the format for userdel is userdel -r login.

[email protected]:~# userdel -r karim

That's it. You can no longer login with that username.

Back to Linux basic commands main page.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.