« How to find out CPU utilization in Linux? | Main | How to create a custom IE8 Accelerator »

How to send message to users logged on to a UNIX terminal?

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.
$who
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 (10.176.146.212)
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.

TrackBack

TrackBack URL for this entry:
http://blogs.oracle.com/mt/mt-tb.cgi/12682

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on May 7, 2009 11:22 AM.

The previous post in this blog was How to find out CPU utilization in Linux?.

The next post in this blog is How to create a custom IE8 Accelerator.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type and Oracle