Hello and welcome back to this lesson. So
in this video we are
going to see some of the user information and management commands
that are used in Linux operating
system.
Alright 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 route. 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.
Alright, 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
uses that have
logged 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 uses 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 is root as you
can see login idle jcpu pcpu
and what they are currently doing.
So this command displays the current login 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
AD 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 -
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 use a
Dell, 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 / EDC slash past
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 in 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
In slash Etc slash past
WD 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 in 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.