write - Sends messages to other users
write [-r] [-n node] user [line]
write [email protected] [line]
write -h handle,reply
write -q [-n node]
The write command allows you to converse with another user who is logged in.
you to send messages to users on other hosts (usually from a shell script)
and to wait for replies; use
reply to such messages.
Interfaces documented on this reference page conform to industry standards as follows:
write: XPG4, XPG4-UNIX
Refer to the
reference page for more information
about industry standards and associated tags.
[Compaq] 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.
Login name of the user with whom you wish to converse. This operand is in the form written by the who utility.
When two users converse with write, each user alternately sends and receives short messages from their respective terminals.
[Compaq] 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 denied.
When you run the write command, it immediately sends the following message to the person whose login name you entered.
Message from sender on node (ttynn) [date]...
[Compaq] 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.
[Compaq] 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.
[Compaq] 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.
[Compaq] If you have superuser authority, you can write to any terminal regardless of the terminal's message permission.
[Compaq] The write command filters nonprintable characters and transmits them in their printed form (that is, ASCII sequence 001 is transmitted as ^A).
[Compaq] 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).
[Compaq] 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.
utility is considered to be a more usable
utility on full-screen terminals.
[Compaq] 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 host.
for information on how to start
or stop the
[Compaq] The write -r command is used to send messages to users and to wait for replies. Their responses determine the exit value: [Compaq] Exit status 0 (zero). [Compaq] Exit status 1. [Compaq] Message for handle redisplays; write does not exit.
An exit status of 2 indicates that the user could not be contacted.
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. <Ctrl-d>
The following environment variables affect the execution of
Provides a default value for the internationalization variables
that are unset or null. If
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
LC_CTYPE, the results
Determines the locale for the format and contents of diagnostic
messages written to standard error.
Determines the location of message catalogues for the processing
Contains user and accounting information.
Commands: mesg(1), login(1), sh(1b), sh(1p), talk(1), wall(1), who(1), writesrv(8)