0% found this document useful (0 votes)
24 views7 pages

UNIX UNIT 9-Compressed

The document discusses electronic communication tools in UNIX systems. It describes commands like mesg, write, finger, and wall that allow communication between users on the same system. It also covers using email via the mail command to exchange messages between UNIX systems connected over a network.

Uploaded by

Rajesh Bale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views7 pages

UNIX UNIT 9-Compressed

The document discusses electronic communication tools in UNIX systems. It describes commands like mesg, write, finger, and wall that allow communication between users on the same system. It also covers using email via the mail command to exchange messages between UNIX systems connected over a network.

Uploaded by

Rajesh Bale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

UNIX System CHAPTER

Communication 9
9.1 INTRODUCTION

Since a UNIX system is used


by multiple users,
iral and necessary. Electronic
is natural communication through the system
mail or email is the
IINIX, Email is fast and cheap and can be used easiest method of
on
to exchange
communicati1on
files. graphics, sound and Video

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

Example 9.1 mesg


$mesg y # grants the write permission.
$mesg n #denies the write permission.
$mesg #displays current status of the write
is # permission of that terminal
262 UNIX

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

9.3 THE WRITE COMMAND


The write command allows a twoway communication between two useras
currently logged-in and who have given write permission. For example, the user
who re
(ogin name) sends a message to the user pratibha as follows:

Example 9.2 write

$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:

Message from rama@maharani on pts/2 at 14:43....


Going on a tour? Happy Journey.
Rama
EOF

Now she can reply to user rama by typing:

$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.

Both users must be logged-in. Otherwise an error message is displayed.

9.4 THE FINGER COMMAND


The finger command is similar to who command, giving information about
currently logged-in users. It lists the details of the users who have logged-in and who ha
ssion
given permission to accept messages. The users who have logged-in, but denied permiss
receive messages are pre fixed by an asterisk as shown in the example, 9.3.
ASstem Communication

263

Example 9.3 finger


#finger

Login Name Tty Tdle


rama
Login Time office office phone
rama pts/1 Feb 28 13:57
root
root *:0
Feb 28 13:31
uma Uma Iyya
pts/2 1 Feb 28 14:21
pratibha Pratibha M pts/3 Feb 28 14:15
sfinger rama

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

In the above example


login shows the login name of users
#Name shows the full name of the users.
#Tty column shows the device number of the terminals.
The idle column shows the idle time since the user logged in.
The Login Time column shows the time of logging-in of the users.
The office and Office Phone columns shows address and phone number of the
user.

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.

Example 9.4: finger

$finger pratibha
Login pratibha Name Pratibha M
Directory: /home/pratibha Shell: /bin/bash
Never logged in.
No mail.
No Plan.

9.5 THE WALL COMMAND


This command can be used only by the Super user (in UNIX) wall stands for write
used to message which
al It be
can send to all the
users on
system, is known
command enables the system administrator
as

Casting a message to all users. The wall


264
UNIX Programming
to send messages to all other users, irrespective of whether they have given Wrie.
permission or not. rite
The wall executable file is stored in the letc directory and is not
PATH variable. Therefore the user has to use the entire
included in the
pathname to use it.
However :in
Linux, the path need not be specified.

Example 9.5 wall


# wall
These may be a Power Failure
Please save your files.
ctrl d

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.

9.6 ELECTRONIC MAIL


Sending and receiving messages using
computer and communication tools, is known
as electronic mail or e-mail. Messages can be transferred
between any systems, provided
they are connected by network. They may be close to each other in the
they may be physically far apart.
same building, or

9.6.1 Sending a mail


The mail command is the
editor using which, mail can be simplest
and most basic e-mail
program. It contains a text
receive mails. The composed. This command can be used to send as
general syntax of mail command to send mail to one orwell as
destination is: more

$mail options addresses


message text

Example 9.6: send mail


$mail user1 user2
Subject Seminar
This is to inform you, that there
will be a
meeting on syllabus revision at 4.00 p.m.
I request you to attend the same. to-day.
Thanks
Rama
<ctrl d>
System Conunne atiom

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

You have new


mall
d1ftshe user in not loRged-in when the mail in sent ty
him, then the menage
You have mail

ie lashed on his screen an noon an he logs in.


when the mail to be sent is a large text file or shell seript etc., the redirections
operator is used as shown:

$mail user1 user2<UnixLab

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

mailbox of the user.


without interrupting the user's
#If the 1 ceiver is logged-in, when the mail is sent,
mail" is flashed on his screen.
work, the message "You have he
his screen as soon as
this message appears on
If the receiver is not logged-in,
logs in. UNIX checks for
contains the value 600.
MAILCHECK is a UNIX variable, The default value can be
600 seconds (10 minutes).
arrival of mails, once in every
changed if required.
To view the mails stored in the mailbox:

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

N Displays the mail numbered N.


d Deletes the current mail.
dn Deletes mail n
Undeletes the current mail,
provided the user has not exited the mai prompt.
w filename Saves the current message in filename
(SHOME/mbox if filename is not specified)
Reply to current mail
rn Reply to sender of mail n
m user
Forwards the mail to user.
Quits the mail program
Print previous message
Print next message

Figure 9.2 Internal mail commands


A personal mailbox called mbox is located in the users' home
directory. Any
message which is not deleted, but read, will be saved in this file when user quits
the mail program.
systemCommunication

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

Long Answer Questions


Explain sending of mails in UNIX.
2Explain
2
UNIX system communication.
Write a note on

(a) write b) wall (c)mail


4 Explain the finger command in UNIX with an example.
5. How do you receive mail in UNIX? Explain.

You might also like