Tuesday 23 September 2014

Sending a Broadcast Message to All Users on a Unix Network

Broadcast a Message on Unix Network !

This is a simple tutorial in the Unix / Linux environment, to broadcast a message to all the users logged into that machine or network. You can even direct the message to a particular user by giving additional options. So here's how it goes.

The Scripts

The two scripts that we can use are write and wall (write to all). We can use the write command to send directed messages, to specific users. If we want to send a broadcast message to all users over a network, we can use the wall command which, as its name suggests, sends the message to all users who are on the network or are connected to the machine.

The Syntax

Using the write command, specify the username and terminal name as 
  $write username tty
   Write your message here.
   ^D
If you don't know the terminal name, just use the who -Hu command. Get the terminal name from the tty column. ^D is Ctrl + d to end and send the message.

The wall command is relatively easier. It can be used in two ways; Either as a solo command as
   $wall
   Write your message here.
   ^D
Or else as a suffix with the echo command as
   $echo Write your message here | wall
This will send the message "Write your message here" to every user on the network.
Queries ?
Comment below.

No comments:

Post a Comment