write
PURPOSE
Sends messages to other users on the system.
SYNOPSIS
write [-n node -r][-h handle][-q][user][line]
DESCRIPTION
A common use of this command is to converse with another
logged-in user. That is, each user alternately sends and
receives short messages from the other work station.
Long messages can be sent by first putting the complete
message in a file and then redirecting that file as input
to the write command.
For another user to receive your message, that user must
be logged in and must not have refused message permis-
sion. When a person you are trying to reach is not
logged in, you get the message "user not logged in".
When the person you are trying to reach has refused
message permission, you get the message "write:
permission denied".
When you run the write command, it immediately sends the
following message, along with an attention-getting sound
(the ASCII BEL character) to the person whose login name
you entered.
Message from yourid (ttynn)
[date] . . .
After successful connection, write then sends two ASCII
BEL characters to your work station to alert you that
whatever you enter now is being sent to the other user.
Sending continues until you press Ctrl-D, at which point
write sends an end-of-text character to the other work
station and exits.
At this point, the other user can respond by sending a
write message back. For this type of exchange, the fol-
lowing convention is useful: When you first write to
others, wait for them to write back before sending any
text. End a message with a signal such as "o" (over) to
alert the other person to reply. Use "oo" (over and out)
when the conversation is finished.
When you write to a user logged in at more than one work
station, write uses the first login instance found in
file /etc/utmp as the message delivery point, and you get
the message:
userid is logged on more than one place.
You are connected to "work station".
Other locations are:
work station
You can contact this user at another location by speci-
fying the line. line indicates to which work station
(tty00, for example) the message should be sent.
Permission to write to another user is granted or denied
by the other user with the mesg command. Some commands
deny message permission while they are running to prevent
interference with their output. A user with superuser
authority can write to any work station regardless of the
work station's message permission.
If Distributed Services is installed on your system, you
can use the write command to converse with users on other
nodes. You can identify a user on a remote node explic-
itly by using the -n flag or implicitly through entries
in the file /etc/wwwmachines. This file contains a list
of node ids or nicknames of machines at which a user may
be contacted. If you use the -n flag, write does not run
through the list of machines named in /etc/wwwmachines.
The write command is also used by qdaemon to send mes-
sages to users on other nodes and to wait for replies.
The contents of the message becomes the reply. Certain
key words in the reply message are recognized as having
special meaning. If the user replies with the word "ok",
then the original write exits with a status of 0. If the
user replies with the word "cancel", then the write exits
with a status of 1. If the reply contains the word
"query", then the message associated with the handle
given is displayed.
FLAGS
-n node Specifies a remote node. The node field may be
a nickname or a node-id.
-h handle Replies to a message sent by a utility or shell
script using write with the reply option. The
value to be used for handle is generated
internally and supplied to the user in the text
of the original message.
-r Generates a message handle, places it in the
message header, sends the message, and waits
for a reply. This flag is used by qdaemon for
operator messages and can be put in shell
scripts. It is not used for interactive con-
versations. An exit status of 0 indicates that
the reply was "ok", a status of 1 indicates
that the reply was "cancel", and an exit status
of 2 indicates that the user could not be con-
tacted.
-q Queries all messages awaiting replies from
users on a node and displays them with their
handles.
EXAMPLES
1. To write a message to a user who is logged in:
write scottie
I need to see you! Meet me in the computer room at 12:30.
Ctrl-D
If your user ID is "kirk" and you are using work
station "tty3", "scottie"'s work station displays:
Message from kirk tty3...
I need to see you! Meet me in the computer room at 12:30.
EOF
2. To hold a conversation:
write scottie
Meet me in the computer room at 12:30.
(o)
This starts the conversation. The "(o)" at the end
stands for "over." It tells" scottie" that you are
waiting for a response. Do not press Ctrl-D if you
wish to continue.
Now "Scottie" replies by typing:
write kirk
I'm running tests at 12:30. Can we meet at 3?
(o)
And you might respond:
write scottie
OK--the computer room at 3.
(oo)
The "(oo)" stands for "over and out," telling
"Scottie" that you have nothing more to say. If
"Scottie" is also finished ("oo"), then you both
press Ctrl-D to end the conversation.
3. To write someone a prepared message:
write jay <message.text
This writes the contents of the file "message.text"
to "fred"'s work station.
4. To write to the person using a certain work station:
write - console
The printer in building 998 has jammed.
Please send help.
Ctrl-D
This writes the message to the person logged in at
the work station /dev/console.
5. To send a message to user "spuds" at node "partya":
write -n partya spuds
Your new tape has just arrived,
come see me to pick it up.
Thanks!
Ctrl-D
6. Here is an example of a message sent by qdaemon:
Message from mary on node 10813661 [ Aug 17 10:03:34 & rbrk. ...
[ Sent by qdaemon, use "write -h 6398492" to reply ]
Please insert tape number 5 into rmt0.
EOF
To reply in the affirmative enter:
write -h 6398492
ok
Ctrl-D
To reply in the negative enter:
write -h 6398492
cancel
Ctrl-D
Note: With the -h flag, there is no need to supply
the node id or user id. This information is tracked
with the handle.
FILES
/etc/utmp Contains user and accounting informa-
tion for the who, write, and login
commands.
/etc/wwwmachines Contains node ids and nicknames of
machines at which the users may be
contacted.
RELATED INFORMATION
The following commands: "mesg," "nroff, troff," "pr,"
"sh," "wall," and "who."