Ubuntu: How to Remove a User Account

From time to time, it becomes necessary to remove a user account from your computer. Removing a user account from your Ubuntu system is a simple task that requires two separate terminal commands.

1. Open a terminal window.

2. First, you’ll need to delete the user account. Input the following command and hit Enter (change to the name of the user account that is to be removed):sudo userdel
3. Now you’ll want to delete the Home directory for the deleted user account. Input the following command and hit Enter (change to the name of the user account that is to be removed):sudo rm -r /home//


About Rob Rogers

Once a prolific author here on Tech-Recipes, Rob has moved on to greener pastures.
View more articles by Rob Rogers

The Conversation

Follow the reactions below and share your own thoughts.

20 Responses to “Ubuntu: How to Remove a User Account”

  1. February 18, 2009 at 10:18 pm, CS said:

    sudo userdel -r [username]

    removes the user’s home directory as well as deleting the user.


  2. April 24, 2009 at 3:27 pm, Stefan said:

    Thanks – it worked a treat.


  3. May 27, 2009 at 2:10 am, blake said:

    thanks. very helpful


  4. June 28, 2009 at 8:37 pm, Mark said:

    I believe this way is better:

    sudo userdel -r NameOfUserToDelete


  5. October 07, 2009 at 4:31 am, Anonymous said:

    ubuntu is very helpful linux operating system


  6. February 24, 2010 at 10:31 pm, Anonymous said:

    deluser is more helpful -> it deleted the user and its user folder.


  7. February 25, 2010 at 11:16 am, Windows User said:

    Nice, I’ve just deleted my home folder with all the data from all the users.

    I am trying to learn linux and that is why I hate linux.

    “following command and hit Enter (change to the name of the user account that is to be removed):
    sudo rm -r /home//”

    change what with my user name? I thought that using “//” will ask me for my user folder or something like that.

    It was nice to state that this tutorial is not for an absolute beginner.
    I am searching for another tutorial to recover my files but there are a ton of unusefull discussions about how not to be dumb and delete by mistake or how to backup but no one tries to explain how to do it.


    • April 17, 2010 at 8:19 pm, Nick said:

      I too am a heavy windows user, and I would never go to a command prompt and type del C:documents and setting thinking it would prompt me for the user. Why would you think it would in Linux.

      This is why I am learning Linux… To get into a community that thinks. Most window users think computers have little fairies doing the actions the user wants and not what they type.


  8. January 11, 2011 at 8:36 pm, jetp said:

    windows user – i’m sorry to hear about the problem you had. i would say the instructions here were unclear. additionally, this could be done through a gui, which is generally safer.
    in generally, the command prompt in linux can be quite dangerous. very powerful, can be extremely efficient, but these ability come at that the cost of commands that can delete a lot of data without a confirmation. i remember once seeing a list of commands that you should never type at the terminal because they will actually delete the entire filesystem. some didn’t even look dangerous! but that is where some basic experience and also the general rule that if you don’t understand a command and you can’t verify what it will do, don’t run it.
    again, sorry for the inconvenience, i hope it hasn’t turned you off from linux indefinitely (and hopefully for novice users, the GUI interfaces that make many operations less dangerous or build in confirmation dialogs will continue to improve.)


  9. March 23, 2011 at 7:40 pm, luke said:

    I hope the author correct his/her sample commands by HTML escaping the ” so string “” shows correctly on a web page. Otherwise this is really confusing and it already done some harms to people.

    sudo userdel
    sudo rm -r /home//


    • March 23, 2011 at 7:43 pm, luke said:

      ironic.. i got tripped up by the auto closing of html tags :)


  10. July 22, 2011 at 8:29 pm, Kevin Li said:

    I agree.


  11. November 24, 2011 at 7:34 am, Sander said:

    If you give an example like following, maybe people won’t accidentally delete their home folder

    sudo userdel [username]
    sudo rm -r /home/[username]/


  12. December 12, 2011 at 11:35 am, zaid said:

    i delete the user but i need to back user can i????? its very imbortant


  13. February 10, 2012 at 2:25 am, gonzalo.cao said:

    tks dude,

    very usefull!


  14. May 10, 2012 at 11:04 am, shanmuganathan said:

    Thanks it works fine


  15. September 16, 2012 at 11:43 pm, Jarod Cook said:

    If you’re ever unsure of what a command will do, put –help by the base command. Like rm –help or userdel –help.


  16. September 17, 2012 at 8:14 am, sd said:

    sudo userdel -r namedelete


  17. October 21, 2012 at 9:51 am, Vaccix said:



  18. June 19, 2013 at 8:13 am, Bouke said:

    `deluser` can also remove the user’s files and cleans up empty groups.


Leave a Reply