Before using write command Check if it is avaliable in you system. From the terminal Run
[root@localhost ~]# which write
which should give
[root@localhost ~]# which write
/usr/bin/write
If write is not installed Install bsdmainutil package
Once Installed to sent message to a particular user we need to know which users are currently logged into the System
[root@localhost ~]# w
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
ashwin :0 - 15Feb10 ?xdm? 7:56m 0.21s /usr/bin/gnome-session
ashwin pts/1 :0.0 11:34 22.00s 1.08s 0.01s gnome-terminal
demo1 pts/2 :0.0 11:58 11.00s 1.07s 1.2s gnome-terminal
demo2 pts/3 :0.0 01:58 8.00s 0.16s 1.8s gnome-terminal
ashwin pts/4 :0.0 12:58 1:47 4.02s 0.02s bash
Now you have the list of users logged in.
METHOD 1
[root@localhost ~]# write ashwin pts/4
Your Message 1
Your Message 2
Your Message 3
Once Done
“Terminate the write by ctrl+D.”
The User "ashwin" would see the message into the console as
[ashwin@localhost ~]$
Message from ashwin@localhost (as root) on pts/2 at 12:49 ...
Your Message 1
Your Message 2
Your Message 3
EOF
METHOD 2
[ashwin@localhost ~]$ echo "Test Message Using Write from http://linuxmaza.com" > /dev/pts/3
The above command will display a message to User "demo2" on the console.
Write Command Runs on all linux distros and installed by default in Fedora, Centos. Please refer the documentation if it is not installed under you linux distribution.
No comments:
Post a Comment