| 1 |
.\" |
| 2 |
.\" Copyright (c) 2009-2025 Craig Small <[email protected]> |
| 3 |
.\" Copyright (c) 2015-2024 Jim Warner <[email protected]> |
| 4 |
.\" Copyright (c) 2012-2013 Jaromir Capik <[email protected]> |
| 5 |
.\" Copyright (c) 2011-2012 Sami Kerola <[email protected]> |
| 6 |
.\" Copyright (c) 2002-2004 Albert Cahalan |
| 7 |
.\" |
| 8 |
.\" This program is free software; you can redistribute it and/or modify |
| 9 |
.\" it under the terms of the GNU General Public License as published by |
| 10 |
.\" the Free Software Foundation; either version 2 of the License, or |
| 11 |
.\" (at your option) any later version. |
| 12 |
.\" |
| 13 |
.\" |
| 14 |
.TH W 1 2025-11-29 procps-ng |
| 15 |
.SH NAME |
| 16 |
w \- Show who is logged on and what they are doing. |
| 17 |
.SH SYNOPSIS |
| 18 |
.B w |
| 19 |
.RI [ option " .\|.\|.\&]" |
| 20 |
.RI [ user ] |
| 21 |
.SH DESCRIPTION |
| 22 |
.B w |
| 23 |
displays information about the users currently on the machine, and their |
| 24 |
processes. The header shows, in this order, the current time, how long the |
| 25 |
system has been running, how many users are currently logged on, and the |
| 26 |
system load averages for the past 1, 5, and 15 minutes. |
| 27 |
.PP |
| 28 |
The following entries are displayed for each user: login name, the tty name, |
| 29 |
the remote host, login time, idle time, JCPU, PCPU, and the command line of |
| 30 |
their current process. |
| 31 |
.PP |
| 32 |
The JCPU time is the time used by all processes attached to the tty. It does |
| 33 |
not include past background jobs, but does include currently running |
| 34 |
background jobs. |
| 35 |
.PP |
| 36 |
The PCPU time is the time used by the current process, named in the "what" |
| 37 |
field. |
| 38 |
.SH OPTIONS |
| 39 |
.TP |
| 40 |
\fB\-c\fR, \fB\-\-container\fR |
| 41 |
show the container uptime instead of system uptime in the header. |
| 42 |
.TP |
| 43 |
\fB\-h\fR, \fB\-\-no\-header\fR |
| 44 |
Don't print the header. |
| 45 |
.TP |
| 46 |
\fB\-u\fR, \fB\-\-no\-current\fR |
| 47 |
Ignores the username while figuring out the |
| 48 |
current process and cpu times. To demonstrate this, do a |
| 49 |
.B su |
| 50 |
and do a |
| 51 |
.B w |
| 52 |
and a |
| 53 |
.BR "w \-u". |
| 54 |
.TP |
| 55 |
\fB\-s\fR, \fB\-\-short\fR |
| 56 |
Use the short format. Don't print the login time, JCPU or PCPU times. |
| 57 |
.TP |
| 58 |
\fB\-t\fR, \fB\-\-terminal\fR |
| 59 |
Usually |
| 60 |
.B w |
| 61 |
will use either the systemd sessions table or the utmp file to locate users. |
| 62 |
In \fIterminal mode\fR |
| 63 |
.B w |
| 64 |
will scan the terminal devices and locate user sessions this way. This is not |
| 65 |
a true count of users, for example a user with two xterms will show up twice, |
| 66 |
so the user count in the header will be different. Currently terminal devices |
| 67 |
scanned are \fI/dev/tty*\fR and \fI/dev/pts/*\fR. |
| 68 |
.TP |
| 69 |
\fB\-f\fR, \fB\-\-from\fR |
| 70 |
Toggle printing the |
| 71 |
.B from |
| 72 |
(remote hostname) field. The default as released is for the |
| 73 |
.B from |
| 74 |
field to not be printed, although your system administrator or distribution |
| 75 |
maintainer may have compiled a version in which the |
| 76 |
.B from |
| 77 |
field is shown by default. |
| 78 |
.TP |
| 79 |
\fB\-\-help\fR |
| 80 |
Display help text and exit. |
| 81 |
.TP |
| 82 |
\fB\-i\fR, \fB\-\-ip\-addr\fR |
| 83 |
Display IP address instead of hostname for \fBfrom\fR field. This option only |
| 84 |
works on non-systemd platforms as libsystemd only provides the remote host. |
| 85 |
.TP |
| 86 |
\fB\-p\fR, \fB\-\-pids\fR |
| 87 |
Display pid of the login process/the "what" process in the "what" field. |
| 88 |
The login process is also called the session leader. |
| 89 |
.TP |
| 90 |
\fB\-V\fR, \fB\-\-version\fR |
| 91 |
Display version information. |
| 92 |
.TP |
| 93 |
\fB\-o\fR, \fB\-\-old\-style\fR |
| 94 |
Old style output. Prints blank space for idle times less than one minute. |
| 95 |
.TP |
| 96 |
.B "user " |
| 97 |
Show information about the specified user only. |
| 98 |
.SH ENVIRONMENT |
| 99 |
.TP |
| 100 |
.B PROCPS_CONTAINER |
| 101 |
If $\fBPROCPS_CONTAINER\fR is set, then \fBw\fR behaves as if the \fB\-\-container\fR option has been given. |
| 102 |
.TP |
| 103 |
.B PROCPS_USERLEN |
| 104 |
Override the default width of the username column. Defaults to 8. |
| 105 |
.TP |
| 106 |
.B PROCPS_FROMLEN |
| 107 |
Override the default width of the from column. Defaults to 16. |
| 108 |
.SH FILES |
| 109 |
.TP |
| 110 |
.I /var/run/utmp |
| 111 |
information about who is currently logged on, only for non-systemd hosts. |
| 112 |
.TP |
| 113 |
.I /proc |
| 114 |
process information |
| 115 |
.TP |
| 116 |
.IR /dev/tty* " , " /dev/pts/* |
| 117 |
Terminal device files scanned with \fB\-\-terminal\fR mode. |
| 118 |
.SH BUGS |
| 119 |
.PP |
| 120 |
When using \fB\-\-terminal\fP option, |
| 121 |
.B w |
| 122 |
assumes processes with a parent PID of 0 or 1 are |
| 123 |
.BR agetty (8) |
| 124 |
processes and will not display them. This is prone to both false positive |
| 125 |
and negative errors. |
| 126 |
.PP |
| 127 |
Idle time for users on certain sessions, such as X/Wayland sessions, |
| 128 |
will be incorrect. The \fB\-\-terminal\fR option will show the correct |
| 129 |
idle times for terminal sessions on X/Wayland. |
| 130 |
.PP |
| 131 |
On platforms using |
| 132 |
.BR systemd (1) |
| 133 |
the \fB\-\-ip\-addr\fR option will be ignored and the from column |
| 134 |
will report the remote host as either a hostname or IP address. |
| 135 |
.SH REPORTING BUGS |
| 136 |
Please send bug reports to |
| 137 |
.MT [email protected] |
| 138 |
.ME . |
| 139 |
.SH SEE ALSO |
| 140 |
.BR free (1), |
| 141 |
.BR loginctl (1), |
| 142 |
.BR ps (1), |
| 143 |
.BR systemd (1), |
| 144 |
.BR top (1), |
| 145 |
.BR uptime (1), |
| 146 |
.BR who (1), |
| 147 |
.BR utmp (5), |
| 148 |
.BR agetty (8) |