xref: /freebsd/usr.bin/w/w.1 (revision f126890a)
1.\" Copyright (c) 1980, 1990, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd August 24, 2020
29.Dt W 1
30.Os
31.Sh NAME
32.Nm w
33.Nd "display who is logged in and what they are doing"
34.Sh SYNOPSIS
35.Nm
36.Op Fl -libxo
37.Op Fl dhin
38.Op Fl M Ar core
39.Op Fl N Ar system
40.Op Ar user ...
41.Sh DESCRIPTION
42The
43.Nm
44utility prints a summary of the current activity on the system,
45including what each user is doing.
46The first line displays the current time of day, how long the system has
47been running, the number of users logged into the system, and the load
48averages.
49The load average numbers give the number of jobs in the run queue averaged
50over 1, 5 and 15 minutes.
51.Pp
52The fields output are the user's login name, the name of the terminal the
53user is on, the host from which the user is logged in, the time the user
54logged on, the time since the user last typed anything,
55and the name and arguments of the current process.
56.Pp
57The options are as follows:
58.Bl -tag -width indent
59.It Fl -libxo
60Generate output via
61.Xr libxo 3
62in a selection of different human and machine readable formats.
63See
64.Xr xo_parse_args 3
65for details on command line arguments.
66.It Fl d
67dumps out the entire process list on a per controlling
68tty basis, instead of just the top level process.
69.It Fl h
70Suppress the heading.
71.It Fl i
72Output is sorted by idle time.
73.It Fl M
74Extract values associated with the name list from the specified
75core instead of the default
76.Pa /dev/kmem .
77.It Fl N
78Extract the name list from the specified system instead of the
79default
80.Pa /boot/kernel/kernel .
81.It Fl n
82Do not attempt to resolve network addresses (normally
83.Nm
84interprets addresses and attempts to display them as names).
85When
86.Fl n
87is specified more than once, hostnames stored in utmp are attempted to
88resolve to display them as network addresses.
89.El
90.Pp
91If one or more
92.Ar user
93names are specified, the output is restricted to those users.
94.Sh FILES
95.Bl -tag -width ".Pa /var/run/utx.active" -compact
96.It Pa /var/run/utx.active
97list of users on the system
98.El
99.Sh EXAMPLES
100Show global activity of the system:
101.Bd -literal -offset indent
102$ w
103 8:05PM  up 35 mins, 3 users, load averages: 0.09, 0.35, 0.27
104USER       TTY      FROM            LOGIN@  IDLE WHAT
105fernape    v0       -               7:30PM     - tmux: client (/tmp/tmux-1001/default) (tmux)
106root       v1       -               8:03PM     1 -bash (bash)
107fernape    pts/0    tmux(1391).%0   8:04PM     - w
108.Ed
109.Pp
110Show the entire process list per tty:
111.Bd -literal -offset indent
112$ w -d
113 8:12PM  up 42 mins, 3 users, load averages: 0.01, 0.11, 0.17
114USER       TTY      FROM            LOGIN@  IDLE WHAT
115                1199      login [pam] (login)
116                1207      -bash (bash)
117                1507      tmux: client (/tmp/tmux-1001/default) (tmux)
118fernape    v0       -               7:30PM     - tmux: client (/tmp/tmux-1001/default) (tmux)
119                1488      login [pam] (login)
120                1489      -bash (bash)
121root       v1       -               8:08PM     3 -bash (bash)
122                1510      -bash (bash)
123                1515      w -d
124fernape    pts/0    tmux(1509).%0   8:11PM     - w -d
125.Ed
126.Pp
127Same as above but only for the root user and omitting the heading:
128.Bd -literal -offset indent
129$ w -d -h root
130		1183      login [pam] (login)
131		1204      -bash (bash)
132root       v1       -       7:15PM     - -bash (bash)
133.Ed
134.Sh COMPATIBILITY
135The
136.Fl f ,
137.Fl l ,
138.Fl s ,
139and
140.Fl w
141flags are no longer supported.
142.Sh SEE ALSO
143.Xr finger 1 ,
144.Xr ps 1 ,
145.Xr uptime 1 ,
146.Xr who 1 ,
147.Xr libxo 3 ,
148.Xr xo_parse_args 3
149.Sh HISTORY
150The
151.Nm
152command appeared in
153.Bx 3.0 .
154.Sh BUGS
155The notion of the
156.Dq current process
157is muddy.
158The current algorithm is
159.Do
160the highest numbered process on the terminal
161that is not ignoring interrupts, or, if there is none, the highest numbered
162process on the terminal
163.Dc .
164This fails, for example, in critical sections of programs like the shell
165and editor, or when faulty programs running in the background fork and fail
166to ignore interrupts.
167(In cases where no process can be found,
168.Nm
169prints
170.Ql \- . )
171.Pp
172The CPU time is only an estimate, in particular, if someone leaves a background
173process running after logging out, the person currently on that terminal is
174.Dq charged
175with the time.
176.Pp
177Background processes are not shown, even though they account for
178much of the load on the system.
179.Pp
180Sometimes processes, typically those in the background, are printed with
181null or garbaged arguments.
182In these cases, the name of the command is printed in parentheses.
183.Pp
184The
185.Nm
186utility does not know about the new conventions for detection of background
187jobs.
188It will sometimes find a background job instead of the right one.
189