1WRITE(1P)                  POSIX Programmer's Manual                 WRITE(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       write — write to another user
14

SYNOPSIS

16       write user_name [terminal]
17

DESCRIPTION

19       The write utility shall read lines from the standard  input  and  write
20       them  to  the  terminal  of  the specified user. When first invoked, it
21       shall write the message:
22
23           Message from sender-login-id (sending-terminal) [date]...
24
25       to user_name.  When it has successfully completed the  connection,  the
26       sender's  terminal  shall  be  alerted  twice to indicate that what the
27       sender is typing is being written to the recipient's terminal.
28
29       If the recipient wants to reply, this can be accomplished by typing:
30
31           write sender-login-id [sending-terminal]
32
33       upon receipt of the initial message. Whenever a line of input as delim‐
34       ited  by an NL, EOF, or EOL special character (see the Base Definitions
35       volume of POSIX.1‐2008, Chapter  11,  General  Terminal  Interface)  is
36       accumulated  while  in canonical input mode, the accumulated data shall
37       be written on the other user's terminal. Characters shall be  processed
38       as follows:
39
40        *  Typing <alert> shall write the <alert> character to the recipient's
41           terminal.
42
43        *  Typing the erase and kill characters shall affect the sender's ter‐
44           minal  in the manner described by the termios interface in the Base
45           Definitions volume of POSIX.1‐2008, Chapter  11,  General  Terminal
46           Interface.
47
48        *  Typing the interrupt or end-of-file characters shall cause write to
49           write an appropriate message ("EOT\n" in the POSIX locale)  to  the
50           recipient's terminal and exit.
51
52        *  Typing  characters  from  LC_CTYPE  classifications  print or space
53           shall cause those characters to be sent to the  recipient's  termi‐
54           nal.
55
56        *  When and only when the stty iexten local mode is enabled, the exis‐
57           tence and processing of additional special control  characters  and
58           multi-byte or single-byte functions is implementation-defined.
59
60        *  Typing  other  non-printable characters shall cause implementation-
61           defined sequences of printable characters  to  be  written  to  the
62           recipient's terminal.
63
64       To  write to a user who is logged in more than once, the terminal argu‐
65       ment can be used to indicate which terminal to write to; otherwise, the
66       recipient's  terminal  is  selected in an implementation-defined manner
67       and an informational message is written to the sender's  standard  out‐
68       put, indicating which terminal was chosen.
69
70       Permission  to  be  a  recipient  of  a  write message can be denied or
71       granted by use of the mesg utility. However,  a  user's  privilege  may
72       further  constrain  the  domain of accessibility of other users' termi‐
73       nals. The write utility shall fail  when  the  user  lacks  appropriate
74       privileges to perform the requested action.
75

OPTIONS

77       None.
78

OPERANDS

80       The following operands shall be supported:
81
82       user_name Login  name  of the person to whom the message shall be writ‐
83                 ten. The application shall ensure that this operand is of the
84                 form returned by the who utility.
85
86       terminal  Terminal  identification  in  the same format provided by the
87                 who utility.
88

STDIN

90       Lines to be copied to the recipient's terminal are read  from  standard
91       input.
92

INPUT FILES

94       None.
95

ENVIRONMENT VARIABLES

97       The  following  environment  variables  shall  affect  the execution of
98       write:
99
100       LANG      Provide a default value for  the  internationalization  vari‐
101                 ables  that are unset or null. (See the Base Definitions vol‐
102                 ume of POSIX.1‐2008, Section 8.2, Internationalization  Vari‐
103                 ables  for  the  precedence of internationalization variables
104                 used to determine the values of locale categories.)
105
106       LC_ALL    If set to a non-empty string value, override  the  values  of
107                 all the other internationalization variables.
108
109       LC_CTYPE  Determine  the  locale for the interpretation of sequences of
110                 bytes of text data as characters (for example, single-byte as
111                 opposed  to  multi-byte  characters  in  arguments  and input
112                 files). If the recipient's locale does not  use  an  LC_CTYPE
113                 equivalent to the sender's, the results are undefined.
114
115       LC_MESSAGES
116                 Determine the locale that should be used to affect the format
117                 and contents of diagnostic messages written to standard error
118                 and informative messages written to standard output.
119
120       NLSPATH   Determine the location of message catalogs for the processing
121                 of LC_MESSAGES.
122

ASYNCHRONOUS EVENTS

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

STDOUT

129       An informational message shall be  written  to  standard  output  if  a
130       recipient is logged in more than once.
131

STDERR

133       The standard error shall be used only for diagnostic messages.
134

OUTPUT FILES

136       The recipient's terminal is used for output.
137

EXTENDED DESCRIPTION

139       None.
140

EXIT STATUS

142       The following exit values shall be returned:
143
144        0    Successful completion.
145
146       >0    The  addressed user is not logged on or the addressed user denies
147             permission.
148

CONSEQUENCES OF ERRORS

150       Default.
151
152       The following sections are informative.
153

APPLICATION USAGE

155       The talk utility is considered by some users to be a more usable  util‐
156       ity on full-screen terminals.
157

EXAMPLES

159       None.
160

RATIONALE

162       The  write utility was included in this volume of POSIX.1‐2008 since it
163       can be implemented on all terminal types. The standard developers  con‐
164       sidered the talk utility, which cannot be implemented on certain termi‐
165       nals, to be a ``better'' communications interface. Both of  these  pro‐
166       grams  are  in widespread use on historical implementations. Therefore,
167       the standard developers decided that both utilities  should  be  speci‐
168       fied.
169
170       The format of the terminal name is unspecified, but the descriptions of
171       ps, talk, who, and write require that they all use or accept  the  same
172       format.
173

FUTURE DIRECTIONS

175       None.
176

SEE ALSO

178       mesg, talk, who
179
180       The  Base  Definitions  volume  of POSIX.1‐2008, Chapter 8, Environment
181       Variables, Chapter 11, General Terminal Interface
182
184       Portions of this text are reprinted and reproduced in  electronic  form
185       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
186       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
187       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
188       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
189       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
190       event of any discrepancy between this version and the original IEEE and
191       The  Open Group Standard, the original IEEE and The Open Group Standard
192       is the referee document. The original Standard can be  obtained  online
193       at http://www.unix.org/online.html .
194
195       Any  typographical  or  formatting  errors that appear in this page are
196       most likely to have been introduced during the conversion of the source
197       files  to  man page format. To report such errors, see https://www.ker
198       nel.org/doc/man-pages/reporting_bugs.html .
199
200
201
202IEEE/The Open Group                  2013                            WRITE(1P)
Impressum