Tuesday, February 1, 2011

Linux -- User Communication -- Part-1 -- write command

The communication between/among different users in Linux systems connected in a network is actually just as simple as running some commands. A direct application of a network system, communication is handled expertly by Unix. The commands used for such a communication are as follows:
  1. write
  2. wall
  3. news
  4. mail
The "write" command:
The write command can be used by any user to write something on someone else's terminal, provided the recipient of the message permits communication. There are two pre-requisites for a smooth write operation:
  • The recipient must be logged in, else an error message is inevitable.
  • The recipient must have given permission for messages to reach his or her terminal.
If you do not want the messages to be posted on your terminal, just type the command: mesg n. But, by default the terminal allows messages to be posted on it. To know if the messages can be posted on your terminal or not, just type the command mesg. If the command returns "is y", then messages can be posted on your terminal, otherwise they cannot be posted. Before using the write command, it is a good idea to first ascertain who all are logged in and who allow messages to their terminals.

finger is one command that tells you which users are connected and which, if any can receive messages. It displays a list of all those who have logged in and places a * next to those terminals where mesg is set to n.


Another command that may be used for this purpose is who -T. The command who lists all the users who are currently logged in. When used with -T option, it places a '+' next to users who have allowed messages and a '-' sign beside others.



Now, the default behaviour of write command is as shown below. The first screen-shot is the terminal on the sender side and the second on the receiver side.





Variations of write:
  • Writing to somebody who has set mesg to n on his terminal. The permission gets denied on such occasions. However, if the sender has mesg set to n and the receiver has mesg set to y then the reply to the message is not possible.


    • A user logged in at more than one terminal and you want to send a message only to one terminal. The terminal specified in the command will be sent a message simply. If we do not mention the terminal to which the message should be sent, then the write command comes up with a smart solution in case of confusion. In all the above screen-shots the user is logged in at more than one place. For example, write user tty9 writes to the terminal tty9 of user-name user.
    To know about the next part in Linux user communication to know the wall command, click here.

      11 comments:

      1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai

        ReplyDelete

      Related Posts Plugin for WordPress, Blogger...