write - Sends messages to other users
write [-r] [-n node] user [line]
write user@node [line]
write -h handle,reply
write -q [-n node]
The write command allows you to converse with another user
who is logged in.
[Tru64 UNIX] The write -r command allows you to send messages
to users on other hosts (usually from a shell
script) and to wait for replies; use write -h to reply to
Interfaces documented on this reference page conform to
industry standards as follows:
Refer to the standards(5) reference page for more information
about industry standards and associated tags.
[Tru64 UNIX] Replies to a message sent by a utility or
shell script with write -r. The value to be used for handle
is generated internally and supplied to you in the
text of the original message.
[Tru64 UNIX] The reply can be ok, cancel, or
query. (See EXAMPLES and EXIT STATUS.) [Tru64
UNIX] Specifies a remote host. The node field may
be a nickname or a node ID. This option is used in
place of the user@node argument; the two cannot be
specified together. [Tru64 UNIX] Queries all messages
awaiting replies from users on a node and
displays them with their handles. [Tru64
UNIX] Generates a message handle, places it in the
message header, sends the message, and waits for a
reply. This option can be used for operator messages
and can be put in shell scripts. It is not
used for interactive conversations. (See EXAMPLES
and EXIT STATUS).
Login name of the user with whom you wish to converse.
This operand is in the form written by the who utility.
[Tru64 UNIX] You may append an optional @node if
the user is on a different host. The format of
@node is as much of the remote hostname and domainname
as may be required by your system. The terminal
identification of the terminal where the other
user is logged in. You only need to specify this
parameter if the other user has several sessions
operating on the target host. See DESCRIPTION for
a further explanation.
When two users converse with write, each user alternately
sends and receives short messages from their respective
[Tru64 UNIX] For another user to receive your message,
that user must be logged in and must not have refused message
permission. When a person you are trying to reach is
not logged in, you get the message user is not logged on.
When the person you are trying to reach has refused message
permission, you get the message Write: Permission
When you run the write command, it immediately sends the
following message to the person whose login name you
Message from sender on node (ttynn) [date]...
[Tru64 UNIX] The message is accompanied by attention-getting
sound (three ASCII BEL characters).
After successful connection, the write command then sends
two ASCII BEL characters to your terminal to alert you
that whatever you enter now is being sent to the other
user. Sending continues until you enter the End-of-File
key sequence, at which point write sends an End-of-Text
sequence to the other terminal and exits.
At any point, the other user can respond by sending a
write message back.
[Tru64 UNIX] For this type of exchange, the following
convention is useful. When you first write to others,
wait for them to write back before sending any text. End
a message with a prearranged signal (such as o for over)
to alert the other user to reply.
[Tru64 UNIX] If the ! (exclamation point) character is
found at the beginning of an input line, write calls the
shell to execute the rest of the line as a command.
When you use the write command to contact a user logged in
at more than one terminal, write uses the first login
instance found in the /var/adm/utmp file as the message
delivery point, and you get the message:
user is logged on more than one place. You are connected
to tty. Other locations are: tty ...
You can contact this user at another location by specifying
the line. The parameter line indicates to which terminal
(tty00, for example) the message should be sent.
Permission to use the write command to contact 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.
[Tru64 UNIX] If you have superuser authority, you can
write to any terminal regardless of the terminal's message
[Tru64 UNIX] The write command filters nonprintable
characters and transmits them in their printed form (that
is, ASCII sequence 001 is transmitted as ^A).
[Tru64 UNIX] When the write -r command is used to send
you a message, you can send a reply of ok, cancel, or
query with write -h. (See OPTIONS, EXAMPLES and EXIT STATUS).
[Tru64 UNIX] An argument of a - (dash) following the
write command allows you to specify a specific terminal to
which you want to write as the second argument.
Typing characters from LC_TYPE classifications print or
space causes those characters to be sent to the recipient's
The talk utility is considered to be a more usable utility
on full-screen terminals.
[Tru64 UNIX] The writesrv daemon must be running on the
target host in order for any of the options to work. If
you are not using either the -n option or @host, but using
-h, -q, or -r, the writesrv daemon must be running on your
[Tru64 UNIX] See writesrv(8) for information on how to
start or stop the writesrv daemon.
[Tru64 UNIX] The write -r command is used to send messages
to users and to wait for replies. Their responses
determine the exit value: [Tru64 UNIX] Exit status 0
(zero). [Tru64 UNIX] Exit status 1. [Tru64 UNIX] Message
for handle redisplays; write does not exit.
An exit status of 2 indicates that the user could not be
The following examples assume that the End-of-File key
sequence is <Ctrl-d>. The actual key sequence may be different.
lucy on tty3 writes a message to sue on the same
node: write sue Meet me in the computer room at 12:30.
sue sees: Message from lucy on node (tty3) [Thu Aug
17 11:55:24 1990] Meet me in the computer room at
12:30. <EOT> Holding a conversation: write sue
Meet me in the computer room at 12:30. over
lucy then waits for a response from sue, who
replies: write lucy I'm running tests at 12:30.
Can we meet at 3? over
sue then waits for lucy, who replies and terminates:
OK--the computer room at 3. bye <Ctrl-d>
sue then terminates their side of the conversation.
To write someone a prepared message, enter: write
This writes the contents of the file message.text
to sue's terminal. To write to the person using a
certain terminal, enter: write - console The
printer in building 998 has jammed. Please send
This writes the message to the person logged in on
the system console. To send a message to user sue
at node, enter: write -n node sue
or write sue@node To get a reply to a message, lucy
might enter the following: write -r sue console
Please insert next tape.
sue terminates lucy's message with write -h
or write -h 12345,cancel
or write -h 12345,query
sue then terminates as usual.
Note that with the -h option, there is no need to
supply the hostname or user ID.
ENVIRONMENT VARIABLES [Toc] [Back]
The following environment variables affect the execution
of write: Provides a default value for the internationalization
variables that are unset or null. If LANG is unset
or null, the corresponding value from the default locale
is used. If any of the internationalization variables
contain an invalid setting, the utility behaves as if none
of the variables had been defined. If set to a non-empty
string value, overrides the values of all the other internationalization
variables. Determines the locale for the
interpretation of sequences of bytes of text data as characters
(for example, single-byte as opposed to multibyte
characters in arguments). If the recipient's locale does
not use an equivalent LC_CTYPE, the results are undefined.
Determines the locale for the format and contents of diagnostic
messages written to standard error. Determines the
location of message catalogues for the processing of
Contains user and accounting information.
Commands: mesg(1), login(1), sh(1b), sh(1p), talk(1),
wall(1), who(1), writesrv(8)
[ Back ]