write(1) write(1)
NAME
write - write to another user
SYNOPSIS
write recipient[ ttyname]
text
...
... <CTRL-D>
DESCRIPTION
write is used to send messages to another user. write reads one line
at a time from standard input and echoes the lines read as messages on
the specified user's terminal. When write is invoked, a message header
initially appears on the recipient's terminal indicating the name of
the sender, the terminal, and the time at which the message is sent.
This is followed by the actual messages.
Users may communicate interactively by sending messages to each other
with write (see Two-way conversations).
Before the call
Users who have denied other users permission to write to their termi-
nals (with mesg -n) cannot be written to with write. A user with sys-
tem administrator privileges can write to any terminal.
OPERANDS
recipient
Login name of a user logged in to a terminal. You can also send
yourself messages. If a user is logged in to more than one termi-
nal at the same time, the appropriate terminal can be specified
as well.
The command who lists all currently logged-in users and their
terminals.
ttyname
Number of the terminal on which the recipient is logged in.
ttyname not specified:
write searches the file /var/adm/utmp for the terminal. If
several entries exist because a user is logged in more than once,
write uses the first entry recorded in the file. The following
message is displayed:
Page 1 Reliant UNIX 5.44 Printed 11/98
write(1) write(1)
user is logged on more than one place.
You are connected to "ttyname".
Other locations are:
ttyname
text Text to be sent as a message. write reads from standard input one
line at a time up to an end-of-file signal:
- A line that begins with an exclamation mark (!) is interpreted
as a command; write passes everything that follows the ! in
the line to the shell. The command is then executed, while
write remains in an active state. Any output that the command
writes to standard output will be included in the text to be
sent as a message.
- All other normal lines are sent to the recipient as a message.
- When write encounters the end-of-transmission character
("EOT\n"), it displays this character on the other terminal
and then exits.
- Non-printing characters are converted before they are sent.
Control character will appear as a caret ^ followed by the
appropriate ASCII character; characters with the eighth bit
set will appear in meta notation. For example, '\003' is
displayed as '^C' and '\372' as 'M-z'.
Two-way conversations
Users may communicate interactively by sending messages to each other
with write. Conversation between two users proceeds as follows:
1. User A invokes write with the login name of user B. User B receives
an announcement (message header) informing him or her that user A
wishes to communicate something.
Message from sender (terminal) [time]
User A hears two bell tones to indicate that the connection has
been set up and that user B is able to receive.
2. User B therefore calls write with the login name of user A.
write sender [terminal]
The message header received by user A serves as an acknowledgement.
3. Both users can now communicate with one another. Each user should
end a message with a distinctive signal so that the other knows
when to reply. There should also be a distinctive signal to indi-
cate when the conversation is to be terminated.
Page 2 Reliant UNIX 5.44 Printed 11/98
write(1) write(1)
4. The conversation can be terminated by pressing the <CTRL-D> or the
<DEL> key. The command mesg -n can then be used if other users are
to be denied permission to write further messages.
Page 3 Reliant UNIX 5.44 Printed 11/98
write(1) write(1)
ERROR MESSAGES
user is not logged on or user is not at "tty"
The addressed user has not logged in.
Permission denied.
The addressed user has denied other users permission to write to
his/her terminal (see mesg).
Warning: You have your terminal set to "mesg -n". No reply possible.
Your terminal cannot receive messages from other users.
Can no longer write to ttyname
The user of the other terminal has withdrawn write permission since
transmission started (see mesg).
LOCALE
The LCMESSAGES environment variable governs the language in which
message texts are displayed. If LCMESSAGES is undefined or is defined
as the null string, it defaults to the value of LANG. If LANG is like-
wise undefined or null, the system acts as if it were not internation-
alized.
The LCALL environment variable governs the entire international envi-
ronment. LCALL takes precedence over all the other environment vari-
ables which affect internationalization.
EXAMPLES
Send a message to user karen:
$ write karen
!date
Mon Oct 15 19:00:13 MET 1990
Today, at 15.10,
I decided to quit
smoking! <CTRL-D>
FILES
/var/adm/utmp
The file in which all logged in users are registered.
/usr/bin/sh
Command interpreter for lines beginning with !.
SEE ALSO
mail(1), mailx(1), mesg(1), pr(1), sh(1), talk(1), who(1).
Page 4 Reliant UNIX 5.44 Printed 11/98