Send messages to different users log on to the same server.

One of the cool features of UNIX is that you don’t need to have any software installed to send message to users logged on to that machine. There is a handy command called “write” which enables you to do this. Here is the syntax of this command:

$write username tty

Now the question arises, how to know the tty of a particular user. The “who” command of UNIX comes in to play here. Just shoot “who” command on your terminal and see the magic. You will receive the list of all users logged on to that machine with their tty. Below is an example.

root     :0           May  7 03:51
root     pts/1        May  7 03:51 (:0.0)
root     pts/2        May  7 03:51 (:0.0)
user5    pts/10       May  7 04:17 (dhcp-dwf1-4-10-176-162-74)
user8    pts/13       May  7 04:12 (dhcp-dwf1-4-10-176-162-180)
user9    pts/15       May  7 04:12 (
user7    pts/14       May  7 04:23 (dhcp-dwf1-4-10-176-162-118)
user12   pts/18       May  7 04:14 (dhcp-dwf1-4-10-176-162-119)
user11   pts/23       May  7 04:14 (dhcp-dwf1-4-10-176-162-31)
user1    pts/22       May  7 04:27 (dhcp-dwf1-4-10-176-162-125)
user15   pts/24       May  7 04:14 (dhcp-dwf1-4-10-176-162-65)
user6    pts/12       May  7 04:14 (dhcp-dwf1-4-10-176-162-120)
user2    pts/28       May  7 04:14 (dhcp-dwf1-4-10-176-162-60)
user7    pts/30       May  7 04:14 (dhcp-dwf1-4-10-176-162-118)
user4    pts/31       May  7 04:14 (dhcp-dwf1-4-10-176-162-72)
user10   pts/32       May  7 04:14 (dhcp-dwf1-4-10-176-162-68)
user14   pts/33       May  7 04:14 (dhcp-dwf1-4-10-176-162-27)

If you want to send message to user8, issue following command at your terminal:

$write user8 pts/13

Now write any message you want. To end the message, press Ctrl+D. Your message would be sent.

(copied from) Reference:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s