The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


write - write to another user


write user_name [terminal]


The write utility reads lines from the user's standard input and writes them to the terminal of another user. When first invoked, it writes the message:

Message from sender-login-id (sending-terminal) [date]...

to user_name. When it has successfully completed the connection, the sender's terminal will be alerted twice to indicate that what the sender is typing is being written to the recipient's terminal.

If the recipient wants to reply, this can be accomplished by typing:

write sender-login-id [sending-terminal]

upon receipt of the initial message. Whenever a line of input as delimited by a NL, EOF or EOL special character (see the XBD specification, General Terminal Interface  ) is accumulated while in canonical input mode, the accumulated data will be written on the other user's terminal. Characters are processed as follows:

To write to a user who is logged in more than once, the terminal argument can be used to indicate which terminal to write to; otherwise, the recipient's terminal is selected in an implementation-dependent manner and an informational message will be written to the sender's standard output, indicating which terminal was chosen.

Permission to be a recipient of a write message can be denied or granted by use of the mesg utility. However, a user's privilege may further constrain the domain of accessibility of other users' terminals. The write utility will fail when the user lacks the appropriate privileges to perform the requested action.




The following operands are supported:
Login name of the person to whom the message will be written. This operand must be of the form returned by the who utility.
Terminal identification in the same format provided by the who utility.


Lines to be copied to the recipient's terminal will be read from standard input.




The following environment variables affect the execution of write:
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
If set to a non-empty string value, override the values of all the other internationalisation variables.
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files). If the recipient's locale does not use an LC_CTYPE equivalent to the sender's, the results are undefined.
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output.
Determine the location of message catalogues for the processing of LC_MESSAGES .


If an interrupt signal is received, write will write an appropriate message on the recipient's terminal and exit with a status of zero. It will take the standard action for all other signals.


An informational message will be written to standard output if a recipient is logged in more than once.


Used only for diagnostic messages.


The recipient's terminal will be used for output.




The following exit values are returned:
Successful completion.
The addressed user is not logged on or the addressed user denies permission.




The talk utility is considered by some users to be a more usable utility on full-screen terminals.




The IEEE PASC 1003.2 Interpretations Committee has forwarded concerns about parts of this interface definition to the IEEE PASC Shell and Utilities Working Group which is identifying the corrections. A future revision of this specification will align with IEEE Std. 1003.2b when finalised.


mesg, talk, who, the XBD specification, General Terminal Interface  .

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]