UNIX UNIT 9-Compressed
UNIX UNIT 9-Compressed
Communication 9
9.1 INTRODUCTION
Communicator
(Sender Communicator
or Message (Sender
Receiver) or
Receiver)
Channel
Figure 9.1 Basic Elements ofa
Communication process
UNIX gains its popularity by the communication tools it
in handling communication between provides. UNIX is an expert
systems. The elements involved in a communication
process are the sender, the receiver, the message and the medium
or channel
which the information flows through
(figure
9.1).
9.2 THE MESG COMMAND
UNIX facilitates users to send messages to other user's terminals who are
logged in. This writing on other terminals is
currently
write permission.
possible only if the other terminal has given a
The mesg command is used to
change the write permission of a user. It has two
options.
y for yes and
n for no
when the user does not want to be disturbed, he can deny the write
gramming
mission mission
However, the super user can write on any terminal, even without write permi
$write pratibha
Going on a tour? Happy Journey
-Rama
<ctrl d> # indicates end of message
Immediately this message appears on user pratibha's terminal with a beep sound
she is currently logged in, as shown:
$write rama
followed by her message. The conversation continues until one or both users decide to end
it. This type of communication takes place alternately. The receiver starts communicating
after the sender and the sender starts communication only after the receiver.
263
Login: rama
Name Dr. M.A. Rama
Directory : /home/ rama
Shell: /bin/bash
on since sat Feb. 28 13:57 (IST) on pts/1
No mail
No Plan
Information about a specifie user can be obtained by using his/her login name, as
shown in example.
When a specified user is not logged-in, the following message appears on the
terminal as in example 9.4.
$finger pratibha
Login pratibha Name Pratibha M
Directory: /home/pratibha Shell: /bin/bash
Never logged in.
No mail.
No Plan.
When this command is executed, UNIX displays the following message to all
logged-in users:
Broadcast message from root (pts/3) (sat Jan 09 14:37:28 2016):
There may be a Power Failure.
Please save your files.
265
terminate wriling \he mail
and now the mail
the
login
namen of the loral
user is sMt to userl and vaer,
in
pluh ge
The sent mennnp doen not dircctly
iver in not buny running sppenr on the receiver's termins
inal. If th
a
program, the following
BCrcen,
message is flashed on his
Receiving a mail
9.6.2
The mail command argument is used to receive mails. All incoming mails
without
For instance
stored in a mailbox With the same name as the login name of the user.
are
mailbox filename would also be uma, and it will be stored in /varlspool/mail
he user uma's
drectory.
from different sources is appended to the
# All the mails received by a user
Receive mail
Example 9.7:
$mail
Mail version 3 messages
1 new 1 unread
"/var/spoo0l/mail/rama":
10:30 Labs
Mar 02
uma> Mon 11:40 projects
1 Mar 02
pratibha> Mon prglist
U 2. Mar 02 12:50
<std1> Mon
>N 3.
&
266 UNIX Programm.rg
*The received mails of a user are normally stored in a mailbox The name
mailbox will be the same as his/her login name. T he mailbox 1s found r.
spool/mail directory.
*The first line display the version of the mail program.
*The second line gives a summary of the messages, with their status s
unread and new. It also indicates the mail directory being used and the .
of messages in it.
Next the list of mails are shown. The first character on each line gives s2
each mail. The status may be new (N), unread (U) or a blank indicating 2 -
read message. The (>) character indicates that as the current message.
The ampersand (&) character appearing in the last line is the mail promp:
Several actions can be taken at this prompt such as reading a mail, sar-
deleting, forwarding and quitting the mail program. A ? at this promp: ca- be
entered to seek on-line help. Figure 9.2 1lists some internal mail commar is:
Command Action
<Enter> Displays the current mail
267
REVIEW QUESTIONS
short Answer Questions
What is
the function of mesg
command?
What is the function of write command?
What is the difference between write and wall
What is the use of wall command ? command?
ain the difference between who and
Explain the mail command.
finger commands.
b.
Explain the usage of wall command
SGive any three features of email