In this blog we will see how you can really move users using command line terminal .First of all lets open our terminal , We can press ctrl+alt+ t to do this .
1.First , let’s see whatever users we have , so just give a ls and then /home and you can see the users there .
In order to remove a user what we do is we use a command called userdel
and then the name of the user .Then you need to use a root permission so you can use sudo . Command :
$ sudo userdel user_name .
Now you will observe even if you have given command userdel which is used to delete the user the home directory for the user is not deleted .
So what this command is doing is its going to delete the user name and the password and other data for the user but it’s not going to delete the home directory for the user and it’s also important some time because for example our employee resigns from a company who have a account on a Linux operating system then he resigns andadministrator wants to delete his username but wants to keep his data whatever he work he has done , so this command is used to delete the user so the user is deleted but the data home directory is still here .
2. Now if we want to remove the user directory as well , we will be using additional flag -r . So the command :
$sudo userdel -r user_name .
So if you want to delete the user and also the home directory of the user then use -r flag with userdel command otherwise use userdel with the username.
So in this way you can remove user using Linux Command line terminal .