Hello and welcome back to this lesson.
So in this video, we're going to see some of the user information and management commands that are
used in Linux operating system.
All right.
To begin with, the first command that we are going to see is the ID command.
Now, this command displays the user and group IDs of your current user.
Let us see the output and you can see the user ID is root.
Group ID is root and the groups into this computer is root.
Now, if you are logged in with another user, you will be able to see a different user ID, a different
group ID and different set of groups.
All right, let's move ahead.
Now, the second command is the command, which is last.
So you just have to write last and hit enter this command display.
The last users who have logged in into the system and you can see the name of the users here, the user
is root.
After that, it was a system reboot.
The user admin has also logged in into this computer.
Similarly, you can see the different users that have logged in into this computer.
Here is a user which is wolf, admin, root, etc. So by typing the command last you are able to see
the last users who have logged in into the operating system.
Perfect.
Now, in case you want to see who is logged in currently into the system, you can simply type the command
who and hit enter.
And you can see we are logged in with the current user which is root.
Perfect.
Moving ahead.
If you want to show who is logged in and what they are doing currently, you can simply type W and you
can see the current user which is logged in as a root as you can see.
Log in, idle CPU, CPU and what they are currently doing.
So this command displays the current logged in user and the task that has been performed.
Now in case you want to create a group.
So let's see that how you can create a group or a user.
So let me just clear the screen and let's say we make a new group that is group ADD and the group name
is Test.
Now when I hit enter, a group has been successfully created.
Now let's say we want to add a user with a comment of John Smith and let's create the user's home directory
as well.
So for that we are going to add a user.
So the command is user add hyphen C and let's give it a name as John Smith.
And hyphen M and let's type it as John.
And when I hit enter you can see it says the user.
John already exists.
All right, so let's delete the user for that.
You need to type the command, which is user DEL, which means delete and the name of the user.
So now it's deleted.
Now let's execute this command again and you can see the user has been added successfully.
Now, how to verify if the user has successfully been added.
Simply go to this directory.
Which is.
Cat slash Etsy slash pass WD and hit enter and you can see the latest user which has been successfully
added is John and you can see over here this is the directory of John and home slash.
Here is John.
These are the other users which have been added into this computer.
So now we saw how to add a user.
We saw how to delete a user.
We also saw how to create a group of that user.
Now let's add John account to a specific group, which is suppose sales group.
So for that, we are going to write this command.
Let me just clear the screen, which is user mod, user modify, modify the group to sales of the user,
which is John.
And you can see it says group sales does not exist.
So we have created a group that was test.
So let's see if you are able to add this user to a group which is test and it looks perfect.
Now let us see the user details, which is.
And slash etsy slash pass w rd.
And here you can see the user which is John and the details about it.
Now let's quickly switch the user to John.
So switch user John and now I'm switched to the user, which is John.
Let's verify using the command, which is who am I?
And you can see the current logged in user is John.
Let us type the command ID and an ID.
You can see the user ID is John, the group ID is John and the groups which the user has been added
is test.
I hope you guys understood this.
This is very, very simple yet very important to know how you can add a user, delete a user, and add
that user to a specific group.
Thank you.