Ubuntu: How to Remove a User Account
Posted by Rob Rogers in Linux
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 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 sudo rm -r /home/
About Rob Rogers
View more articles by Rob Rogers
The Conversation
Follow the reactions below and share your own thoughts.
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.
April 24, 2009 at 3:27 pm, Stefan said:
Thanks – it worked a treat.
May 27, 2009 at 2:10 am, blake said:
thanks. very helpful
June 28, 2009 at 8:37 pm, Mark said:
I believe this way is better:
sudo userdel -r NameOfUserToDelete
October 07, 2009 at 4:31 am, Anonymous said:
ubuntu is very helpful linux operating system
February 24, 2010 at 10:31 pm, Anonymous said:
deluser is more helpful -> it deleted the user and its user folder.
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.
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.)
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
July 22, 2011 at 8:29 pm, Kevin Li said:
I agree.
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]/
December 12, 2011 at 11:35 am, zaid said:
i delete the user but i need to back user can i????? its very imbortant
February 10, 2012 at 2:25 am, gonzalo.cao said:
tks dude,
very usefull!
May 10, 2012 at 11:04 am, shanmuganathan said:
Thanks it works fine