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

NAME

12       write — write to another user
13

SYNOPSIS

15       write user_name [terminal]
16

DESCRIPTION

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

OPTIONS

78       None.
79

OPERANDS

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

STDIN

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

INPUT FILES

95       None.
96

ENVIRONMENT VARIABLES

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

ASYNCHRONOUS EVENTS

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

STDOUT

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

STDERR

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

OUTPUT FILES

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

EXTENDED DESCRIPTION

140       None.
141

EXIT STATUS

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

CONSEQUENCES OF ERRORS

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

APPLICATION USAGE

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

EXAMPLES

160       None.
161

RATIONALE

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

FUTURE DIRECTIONS

176       None.
177

SEE ALSO

179       mesg, talk, who
180
181       The  Base  Definitions  volume  of POSIX.1‐2017, Chapter 8, Environment
182       Variables, Chapter 11, General Terminal Interface
183
185       Portions of this text are reprinted and reproduced in  electronic  form
186       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
187       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
188       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
189       Electrical and Electronics Engineers, Inc and The Open Group.   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.opengroup.org/unix/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                  2017                            WRITE(1P)
Impressum