xref: /openbsd/usr.bin/who/who.1 (revision 6f40fd34)
1.\"	$OpenBSD: who.1,v 1.27 2017/06/19 06:05:33 bentley Exp $
2.\"	$NetBSD: who.1,v 1.5 1994/12/07 04:28:47 jtc Exp $
3.\"
4.\" Copyright (c) 1986, 1991, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)who.1	8.2 (Berkeley) 12/30/93
32.\"
33.Dd $Mdocdate: June 19 2017 $
34.Dt WHO 1
35.Os
36.Sh NAME
37.Nm who
38.Nd display who is logged in
39.Sh SYNOPSIS
40.Nm who
41.Op Fl HmqTu
42.Op Ar file
43.Nm who
44.Cm am i
45.Sh DESCRIPTION
46The
47.Nm
48utility displays a list of all users currently logged on, showing for
49each user the login name, tty name, the date and time of login, and
50hostname if not local.
51.Pp
52The options are as follows:
53.Bl -tag -width Ds
54.It Fl H
55Write column headings above the regular output.
56.It Fl m
57Only print information about the current terminal.
58This is the
59POSIX
60way of saying
61.Nm
62.Cm am i .
63.It Fl q
64(Quick.)
65List only the names and the number of users currently logged on.
66When this option is used, all other options are ignored.
67.It Fl T
68Print a character after the user name indicating the state of the
69terminal line:
70.Sq +
71if the terminal is writable;
72.Sq \-
73if it is not;
74and
75.Sq \&?
76if a bad line is encountered.
77.It Fl u
78Print the idle time for each user.
79.It Cm am i
80Returns the invoker's real user name.
81.It Ar file
82By default,
83.Nm
84gathers information from the file
85.Pa /var/run/utmp .
86An alternate
87.Ar file
88may be specified which is usually
89.Pa /var/log/wtmp
90(or
91.Pa /var/log/wtmp.[0-6]
92depending on site policy as
93.Pa wtmp
94can grow quite large and daily versions may or may not
95be kept around after compression by
96.Xr ac 8 ) .
97The
98.Pa wtmp
99file contains a record of every login, logout,
100crash, shutdown and date change
101since
102.Pa wtmp
103was last truncated or
104created.
105.El
106.Pp
107If
108.Pa /var/log/wtmp
109is being used as the file, the user name may be empty
110or one of the special characters
111.Ql | ,
112.Ql } ,
113and
114.Ql \&~ .
115Logouts produce an output line without any user name.
116For more information on the special characters, see
117.Xr utmp 5 .
118.Sh FILES
119.Bl -tag -width /var/log/wtmp.[0-6] -compact
120.It Pa /var/run/utmp
121.It Pa /var/log/wtmp
122.It Pa /var/log/wtmp.[0-6]
123.El
124.Sh EXIT STATUS
125.Ex -std who
126.Sh SEE ALSO
127.Xr last 1 ,
128.Xr mesg 1 ,
129.Xr users 1 ,
130.Xr w 1 ,
131.Xr getuid 2 ,
132.Xr utmp 5
133.Sh STANDARDS
134The
135.Nm
136utility is compliant with the
137.St -p1003.1-2008
138specification.
139.Pp
140The flags
141.Op Fl abdHlpqrst
142are marked by
143.St -p1003.1-2008
144as being an X/Open System Interfaces option.
145Of these,
146.Op Fl abdlprst
147are not supported by this implementation of
148.Nm .
149.Sh HISTORY
150A
151.Nm
152utility appeared in
153.At v1 .
154