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.\" @(#)w.1 8.1 (Berkeley) 6/6/93 29.\" 30.Dd August 24, 2020 31.Dt W 1 32.Os 33.Sh NAME 34.Nm w 35.Nd "display who is logged in and what they are doing" 36.Sh SYNOPSIS 37.Nm 38.Op Fl -libxo 39.Op Fl dhin 40.Op Fl M Ar core 41.Op Fl N Ar system 42.Op Ar user ... 43.Sh DESCRIPTION 44The 45.Nm 46utility prints a summary of the current activity on the system, 47including what each user is doing. 48The first line displays the current time of day, how long the system has 49been running, the number of users logged into the system, and the load 50averages. 51The load average numbers give the number of jobs in the run queue averaged 52over 1, 5 and 15 minutes. 53.Pp 54The fields output are the user's login name, the name of the terminal the 55user is on, the host from which the user is logged in, the time the user 56logged on, the time since the user last typed anything, 57and the name and arguments of the current process. 58.Pp 59The options are as follows: 60.Bl -tag -width indent 61.It Fl -libxo 62Generate output via 63.Xr libxo 3 64in a selection of different human and machine readable formats. 65See 66.Xr xo_parse_args 3 67for details on command line arguments. 68.It Fl d 69dumps out the entire process list on a per controlling 70tty basis, instead of just the top level process. 71.It Fl h 72Suppress the heading. 73.It Fl i 74Output is sorted by idle time. 75.It Fl M 76Extract values associated with the name list from the specified 77core instead of the default 78.Pa /dev/kmem . 79.It Fl N 80Extract the name list from the specified system instead of the 81default 82.Pa /boot/kernel/kernel . 83.It Fl n 84Do not attempt to resolve network addresses (normally 85.Nm 86interprets addresses and attempts to display them as names). 87When 88.Fl n 89is specified more than once, hostnames stored in utmp are attempted to 90resolve to display them as network addresses. 91.El 92.Pp 93If one or more 94.Ar user 95names are specified, the output is restricted to those users. 96.Sh FILES 97.Bl -tag -width ".Pa /var/run/utx.active" -compact 98.It Pa /var/run/utx.active 99list of users on the system 100.El 101.Sh EXAMPLES 102Show global activity of the system: 103.Bd -literal -offset indent 104$ w 105 8:05PM up 35 mins, 3 users, load averages: 0.09, 0.35, 0.27 106USER TTY FROM LOGIN@ IDLE WHAT 107fernape v0 - 7:30PM - tmux: client (/tmp/tmux-1001/default) (tmux) 108root v1 - 8:03PM 1 -bash (bash) 109fernape pts/0 tmux(1391).%0 8:04PM - w 110.Ed 111.Pp 112Show the entire process list per tty: 113.Bd -literal -offset indent 114$ w -d 115 8:12PM up 42 mins, 3 users, load averages: 0.01, 0.11, 0.17 116USER TTY FROM LOGIN@ IDLE WHAT 117 1199 login [pam] (login) 118 1207 -bash (bash) 119 1507 tmux: client (/tmp/tmux-1001/default) (tmux) 120fernape v0 - 7:30PM - tmux: client (/tmp/tmux-1001/default) (tmux) 121 1488 login [pam] (login) 122 1489 -bash (bash) 123root v1 - 8:08PM 3 -bash (bash) 124 1510 -bash (bash) 125 1515 w -d 126fernape pts/0 tmux(1509).%0 8:11PM - w -d 127.Ed 128.Pp 129Same as above but only for the root user and omitting the heading: 130.Bd -literal -offset indent 131$ w -d -h root 132 1183 login [pam] (login) 133 1204 -bash (bash) 134root v1 - 7:15PM - -bash (bash) 135.Ed 136.Sh COMPATIBILITY 137The 138.Fl f , 139.Fl l , 140.Fl s , 141and 142.Fl w 143flags are no longer supported. 144.Sh SEE ALSO 145.Xr finger 1 , 146.Xr ps 1 , 147.Xr uptime 1 , 148.Xr who 1 , 149.Xr libxo 3 , 150.Xr xo_parse_args 3 151.Sh HISTORY 152The 153.Nm 154command appeared in 155.Bx 3.0 . 156.Sh BUGS 157The notion of the 158.Dq current process 159is muddy. 160The current algorithm is 161.Do 162the highest numbered process on the terminal 163that is not ignoring interrupts, or, if there is none, the highest numbered 164process on the terminal 165.Dc . 166This fails, for example, in critical sections of programs like the shell 167and editor, or when faulty programs running in the background fork and fail 168to ignore interrupts. 169(In cases where no process can be found, 170.Nm 171prints 172.Ql \- . ) 173.Pp 174The CPU time is only an estimate, in particular, if someone leaves a background 175process running after logging out, the person currently on that terminal is 176.Dq charged 177with the time. 178.Pp 179Background processes are not shown, even though they account for 180much of the load on the system. 181.Pp 182Sometimes processes, typically those in the background, are printed with 183null or garbaged arguments. 184In these cases, the name of the command is printed in parentheses. 185.Pp 186The 187.Nm 188utility does not know about the new conventions for detection of background 189jobs. 190It will sometimes find a background job instead of the right one. 191