[No audio]
Talking to users.
The users are the ones that are logged into
your system and some of them have their applications
running, some of them have databases running.
Those are the users that log into the Linux system and there
are often times you do need to talk to them.
When I say talk to them, not like face to
face but you do need to communicate to them that
if you need to bring down your Linux system or
if there's a maintenance or if there are any commands
or any application that they are running, that are causing stress
on the system, you do need to identify them. Command
to find out is just typing users.
Then there is a command called wall.
wall is the command that is broadcast your message
to everyone who is logged into the Linux system.
And then there is last command which is write
command is dedicated to a user, one specific user.
It does not go out or your
message does not broadcast it to everyone.
It's just one user to another.
So we'll log into our Linux system and we will
try all these commands one by one and we will
see how we could talk to other users.
I have my Linux machine up and running
and I am logged in as myself.
And I could also see here I'm logged in as myself.
The first command that I have is wall.
So before I go into this first command, sorry first command is user,
let's find out who is logged into the system.
But what I was going to say is
before we run this command I will log
into another terminal as a different user.
So to log into through another terminal, which
would be the PuTTY terminal, I would need
the IP address of this Linux machine.
Let's check the IP address.
You guys know that, right? Yes.
We could run ifconfig, and the reason I
put it more, I'm sure you know that
so I could see the output one page at a time.
I see my IP right here is
192.168.1.12.
I will take that IP and I
will put it into my PuTTY session.
192.168.1.12.
[No audio]
You hit enter.
It will prompt you for the server SSH
key that you wanted to save it.
You could just say click Yes.
And now this time I want you
to log in as a different user.
The user that I created earlier, I called the
spider and put in the password for the spider.
Now I'm logged in as a spider.
If you logged in as yourself on your terminal,
you can log out, or you open up another
PuTTY terminal and log into a different user.
And those users are the ones that we created earlier.
You could pick any user, it doesn't really matter.
Now we will see how many
users are logged into our system.
The command to see is just type, sorry, users.
And you'll see there are three users logged in.
Two of them are the ones
sessions that are used by myself.
And the third one is the spider.
spider is the one is this one that I just logged into.
Now I'm here, right now, in this
session, I am logged in as myself.
In this session, I'm logged in as spider.
So if I want to reboot this machine or I
want to shut it down for some kind of maintenance,
then I have to let everyone know who is logged
into my machine, that I am shutting down this machine.
So please save your work
if you are editing a file or whatever that you're
doing, log off the system so I could reboot it.
And how do I broadcast that?
I will just type the command wall.
I'll hit Enter.
Enter one more time if you want to put a space,
and then you could type whatever the
message that you want to type here.
I'll type, Please logoff,
This system is coming down for maintenance.
[No audio]
Imran. That's my message.
And once you have that, then you type Control d.
As soon as you type Control d, you see on the
left hand side, the message came up right away.
Please log off,
The system is coming down for maintenance.
So this message is not only
directed towards spider, the user spider.
It is directed to anyone who is logged in.
It will go to everyone's terminal
and you see that message.
And now you notice you don't have a prompt.
You're just inside of your message,
you simply hit Enter,
you'll get your prompt back.
Now what if I want to write
a message to a specific user?
So in this case, who are the users?
Right now I see that two sessions being used by
iafzal, and one session is used by spider.
I want to send a message to spider saying,
hey spider, you are using some of the resources
through this script or through your application.
Can you please stop the application because
it's causing stress on the system.
These are the type of messages you have to
send it to the user when you become a
system administrator or you have a root privileges.
So to write to user, you just
simply type write and the username spider.
Then you hit Enter.
As soon as you hit Enter, you will
see on the left hand side, the spider
is getting the message right away from you.
I'll put, Hi Spider,
[No audio]
your web is getting bigger.
Please stop spreading your web.
It's just an example of funny sentence.
So I have written this.
I'll hit Enter.
As soon as I hit Enter, you'll see on the
left hand side Hi Spider,, your web is getting bigger.
Please stop spreading your web.
This message is not directed toward
everyone who is logged in.
It's only going to the user spider.
And if you see right here,
it's saying Message from iafzal.
It means it's coming from this user, from this machine. Perfect.
[No audio]
Type write iafzal, and right here I
say, ok Imran I will try my best.
Thanks Spider.
[No audio]
And then control G.
That's it, that's how you communicate with each users.
And I have communicated through iafzal, of course.
And most of the time that communication
takes place through the user se mes
Root is the one who sends those messages
because root has the highest level of permissions,
higher level to reboot the system, to bring
it down, to perform the maintenance.
That's why we run these commands.
So again, users, wall, write.
You can log into three
different sessions, try these commands.
It's going to be fun writing back and forth.
And if you're already in an environment, you're working with
a corporate, you could type the write messages to other
users just to try out, just for fun.
[No audio]