How To Delete Existing

Here I will show you how to delete an existing user in Ubuntu and the way is the same in all Linux flavors. We can remove the ubuntu user in Linux using the single command.

If you simply use userdel <username> command, this will delete the user but it will delete a home directory and mailbox location of the user. so Ubuntu delete user

Check Out: Solve add-apt-repository: Command Not Found on Ubuntu

We can delete a user in ubuntu as well as Centos in the same way. When you have to remove the user from ubuntu, you can use the below commands. 

you can delete a user in ubuntu Linux using the userdel -r <username>. This command will remove all the home directory, mailbox, user group, shadow password, and remove the user from passwd file.

Check Out: Steps To Create/Add Users

By default, when a user is created, it comes with 5 location mention below,
  1. Home directory /home/username

2. Will be defined in /etc/passwd

3. will be defined in /etc/group

4. will have one mailbox location is /var/spool/mail

5. Password will be defined in /etc/shadow

How To Delete Existing Users In Ubuntu Linux:

You can add a user using useradd <username> command.

Check Out: Install Times Roman Font In Ubuntu

 delete user linux

User Delete

Here I will try to add the same user after deleting just to show you as it’s still having home directory and mailbox exists. soso

User Delete with Home directory and mailbox

If you want to remove all of these, you will have to use the option ‘-r‘ to achieve this.

Check Out: How To Clear Cache In Linux

userdel -r <username>

Now you can see it’s not showing any error while adding the same user after removing with the ‘-r‘ option. so

YouTube: Delete User in ubuntu

That’s it. remove user ubuntu remove user linux

LEAVE A REPLY

Please enter your comment!
Please enter your name here