Showing posts with label UNIX User communication commands. Show all posts
Showing posts with label UNIX User communication commands. Show all posts

Wednesday, February 2, 2011

Linux -- User Communication -- Part-3 -- news command

The system administrator is the sole person who can make news under the Linux. He types the information which he wants everyone on the network to know of in different files in /var/lib/sysnews directory. 

Whenever we log in if any fresh news has come in since we logged out last time then a message is displayed on our terminal saying, news: appeal rally where appeal and rally are the names of files in which the news items are available. We may either choose to ignore it, or if any news item interests us we may decide to pursue the same.
  • First, we can look at the names of the news articles by the command news with -n option. Similarly, to know the number of unread news articles that are present in the /var/lib/sysnews directory, we use the command news with -s option. If you try news -s after you have gone through all the news items it promtly displays the message "NEWS: 0 news articles".




  • The command without any options would yield the list of unread news articles one after another.


  • At the same time, the user can pursue only a particular news article  from several items by specifying the article name after the command. For example, if you want to pursue the article named appeal, then you can run the command at the prompt as news appeal


  • If the user decided to pursue all the news articles (read and unread), then the option -a has to be used with the command.

Linux -- User Communication -- Part-2 -- wall command

The write command is used for communication between two users connected to a network. However, if a user wants to send a message to everyone in the network; then the wall command will be used. The command is mostly used by the administrators for purposes such as the situation where the Unix/Linux system will be shut down in 10 minutes. He does so using wall. After giving the entire message, Ctrl - D must be pressed. The default behaviour of wall command is as shown in the below figure:



Another important thing to note about this command is that it writes to all the terminals irrespective of whether the users have given write permission to their terminals or not, as important messages are often posted using the wall.

Thus, this command is used to broadcast a message to everyone on the network and the necessary message is written onto the terminals of all the users.

A variation of wall would be to broadcast the contents in a file to all the terminals. This is done by the command given as: "wall < [file-name]". In this case, Ctrl-D need not be pressed. This is shown in the below figure:



To know about the next part of the Linux user communication, click here.

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.
      Related Posts Plugin for WordPress, Blogger...