Let's monitor users.
We have created them.
Now we have to manage them because that's one of the basic job for any system administrators or engineer
or a systems guy to monitor the users what they are doing in our system.
Some of the commands to monitor those users are who tells you who is in log in to the system last w
finger and ID.
These are the few commands.
There are many other commands as well, but these are the few basic commands that are mostly used in
Linux environment where you could monitor users.
Let's look at our Linux machine by going into our Linux console and run these commands to practice.
We are locked in.
Let's clear our screen and see.
We are good, we are ourself and we are in our directory.
And of course now you should know to type hostname and our host name is is the name of our system.
It's clear this the first command is who who is going to tell you which how many people are logged in
and their user ID, their terminal ID and the time they were logged in.
So I have logged in and my console in my GOI with, with column zero and I have opened up a terminal
right here.
It tells me the RTS is the terminal, so I see zero and the time I opened it up if I wanted to open
up another window.
See do right click and open terminal.
So it'll open up another terminal.
Now, when you type who it should show you three, three terminals that is owned by.
If so, what if I log in as Spider-Man?
So let's go to our putty terminal and put in our IP address.
I believe it's 182 one 6856 101 56.11.
You could check that by again running the command F config.
So we'll open that.
Now, this time we log into this log in Spider-Man.
Okay.
And now let's clear the screen and check.
Now you see, we have four.
One, two, three, four.
And the fourth one is used by Spiderman.
So this is the main function or main purpose of the command.
Who the reason we run this command, who all the time or most of the time is when there is a very high
load in the system.
And you wanted to see how many people are logged into the system.
Next.
Next command we're going to learn is last.
It's close.
The one in the back.
Last command tells you all the details of every uses that have been logged in since the day one.
So when you type last hit enter, you see everything comes up in the screen so fast.
I wanted to see one page at a time.
Then how do I do that?
You do last pipe it and MORET And this will tell you the last time the user that logged in is Spiderman.
Of course, this is the name.
This is the user that logged in.
And this is the time I logged in and it's telling you it is still logged in and it tells you every user
that's been logged in and every user who've been logged in and rebooted the system and whatever happened
to the system.
So let's say if your system reboots or shuts down or crashes unexpectedly and you suspect someone was
logged in and you wanted to see what time they logged in, which IP they used to log into, what date
and time to logged in, all the information is here.
If you wanted to you if you wanted to see the first column of your output of last the size of your last,
write last, and you run that and you wanted to see only the first column, all the user names only
then what command you would run.
This is a kind of pop quiz.
You do last pipe it awk dollar one and you get the first one.
Now you just want to remove the duplicates.
Then what do you do?
You do sort that sorts out and you type unique and then you will see only these are the users that have
been logged in.
I have saw reboot that.
So that's also a protocol that is used to log in Spiderman and there's another user TMP, another command
that will learn as WW works pretty much the same as who, but it'll give you a little more information
than who gives you the log in time, the idle time and what are the processes is being run by what user.
So it gives you a little more detail.
The next one is finger.
When you run finger.
Now the finger command is the command that is that is added to your system.
So it's not it does not come with your distribution.
You have to add it.
It's a program.
It's a very powerful program.
It's basically does the trace of your user where it's coming from, what kind of protocol is using.
So you need to install that.
So we will leave that out for now.
The next one is ID and you hit ID without the username.
It will give you the information about your own self, your username, your group ID, and what part
of other groups you are.
If you run ID and you do spider-men, then it will give you the information about the other users.
So these are a few commands to monitor the users.
I hope you will remember them and I hope you will practice them again.
The way to practice is to run them with different options.
And how do you find the options?
Is by running man and do who and you will find different options.
And I would highly urge you to please use different options just for practice.