1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
who(P) who(P)
NAME
who - display who is on the system
SYNOPSIS
who [-mTu]
who [-mu]-s[-bHlprt][file]
who [-mTu][-abdHlprt][file]
who -q [file]
who am i
who am I
DESCRIPTION
The who utility shall list various pieces of information
about accessible users. The domain of accessibility is
implementation-defined.
Based on the options given, who can also list the user's
name, terminal line, login time, elapsed time since
activity occurred on the line, and the process ID of the
command interpreter for each current system user.
OPTIONS
The who utility shall conform to the Base Definitions
volume of IEEE Std 1003.1-2001, Section 12.2, Utility
Syntax Guidelines.
The following options shall be supported. The metavari-
ables, such as <line>, refer to fields described in the
STDOUT section.
-a Process the implementation-defined database or
named file with the -b, -d, -l, -p, -r, -t, -T
and -u options turned on.
-b Write the time and date of the last reboot.
-d Write a list of all processes that have expired
and not been respawned by the init system
process. The <exit> field shall appear for dead
processes and contain the termination and exit
values of the dead process. This can be useful in
determining why a process terminated.
-H Write column headings above the regular output.
-l (The letter ell.) List only those lines on which
the system is waiting for someone to login. The
<name> field shall be LOGIN in such cases. Other
fields shall be the same as for user entries
except that the <state> field does not exist.
-m Output only information about the current termi-
nal.
-p List any other process that is currently active
and has been previously spawned by init.
-q (Quick.) List only the names and the number of
users currently logged on. When this option is
used, all other options shall be ignored.
-r Write the current run-level of the init process.
-s List only the <name>, <line>, and <time> fields.
This is the default case.
-t Indicate the last change to the system clock.
-T Show the state of each terminal, as described in
the STDOUT section.
-u Write "idle time" for each displayed user in
addition to any other information. The idle time
is the time since any activity occurred on the
user's terminal. The method of determining this
is unspecified. This option shall list only
those users who are currently logged in. The
<name> is the user's login name. The <line> is
the name of the line as found in the directory
/dev. The <time> is the time that the user logged
in. The <activity> is the number of hours and
minutes since activity last occurred on that par-
ticular line. A dot indicates that the terminal
has seen activity in the last minute and is
therefore "current". If more than twenty-four
hours have elapsed or the line has not been used
since boot time, the entry shall be marked <old>.
This field is useful when trying to determine
whether a person is working at the terminal or
not. The <pid> is the process ID of the user's
login process.
OPERANDS
The following operands shall be supported:
am i, am I
In the POSIX locale, limit the output to describ-
ing the invoking user, equivalent to the -m
option. The am and i or I must be separate argu-
ments.
file Specify a pathname of a file to substitute for
the implementation-defined database of logged-on
users that who uses by default.
STDIN
Not used.
INPUT FILES
None.
ENVIRONMENT VARIABLES
The following environment variables shall affect the
execution of who:
LANG Provide a default value for the internationaliza-
tion variables that are unset or null. (See the
Base Definitions volume of IEEE Std 1003.1-2001,
Section 8.2, Internationalization Variables for
the precedence of internationalization variables
used to determine the values of locale cate-
gories.)
LC_ALL If set to a non-empty string value, override the
values of all the other internationalization
variables.
LC_CTYPE
Determine the locale for the interpretation of
sequences of bytes of text data as characters
(for example, single-byte as opposed to multi-
byte characters in arguments).
LC_MESSAGES
Determine the locale that should be used to
affect the format and contents of diagnostic mes-
sages written to standard error.
LC_TIME
Determine the locale used for the format and con-
tents of the date and time strings.
NLSPATH
Determine the location of message catalogs for
the processing of LC_MESSAGES .
TZ Determine the timezone used when writing date and
time information. If TZ is unset or null, an
unspecified default timezone shall be used.
ASYNCHRONOUS EVENTS
Default.
STDOUT
The who utility shall write its default format to the
standard output in an implementation-defined format,
subject only to the requirement of containing the infor-
mation described above.
XSI-conformant systems shall write the default informa-
tion to the standard output in the following general
format:
<name>[<state>]<line><time>[<activity>][<pid>][<comment>][<exit>] <img
src="../images/opt-end.gif" border="0">
The following format shall be used for the -T option:
"%s %c %s %s\n" <name>, <terminal state>, <terminal name>,
<time of login>
where <terminal state> is one of the following charac-
ters:
+ The terminal allows write access to other users.
- The terminal denies write access to other users.
? The terminal write-access state cannot be deter-
mined.
In the POSIX locale, the <time of login> shall be equiv-
alent in format to the output of:
date +"%b %e %H:%M"
If the -u option is used with -T, the idle time shall be
added to the end of the previous format in an unspeci-
fied format.
STDERR
The standard error shall be used only for diagnostic
messages.
OUTPUT FILES
None.
EXTENDED DESCRIPTION
None.
EXIT STATUS
The following exit values shall be returned:
0 Successful completion.
>0 An error occurred.
CONSEQUENCES OF ERRORS
Default.
The following sections are informative.
APPLICATION USAGE
The name init used for the system process is the most
commonly used on historical systems, but it may vary.
The "domain of accessibility" referred to is a broad
concept that permits interpretation either on a very
secure basis or even to allow a network-wide implementa-
tion like the historical rwho.
EXAMPLES
None.
RATIONALE
Due to differences between historical implementations,
the base options provided were a compromise to allow
users to work with those functions. The standard devel-
opers also considered removing all the options, but felt
that these options offered users valuable functionality.
Additional options to match historical systems are
available on XSI-conformant systems.
It is recognized that the who command may be of limited
usefulness, especially in a multi-level secure environ-
ment. The standard developers considered, however, that
having some standard method of determining the "accessi-
bility" of other users would aid user portability.
No format was specified for the default who output for
systems not supporting the XSI Extension. In such a
user-oriented command, designed only for human use, this
was not considered to be a deficiency.
The format of the terminal name is unspecified, but the
descriptions of ps, talk, and write require that they
use the same format.
It is acceptable for an implementation to produce no
output for an invocation of who mil.
FUTURE DIRECTIONS
None.
SEE ALSO
mesg
COPYRIGHT
Portions of this text are reprinted and reproduced in
electronic form from IEEE Std 1003.1, 2003 Edition,
Standard for Information Technology -- Portable Operat-
ing System Interface (POSIX), The Open Group Base Speci-
fications Issue 6, Copyright (C) 2001-2003 by the Insti-
tute of Electrical and Electronics Engineers, Inc and
The Open Group. In the event of any discrepancy between
this version and the original IEEE and The Open Group
Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be
obtained online at http://www.open-
group.org/unix/online.html .
POSIX 2003 who(P)
|