1 '\" te
   2 .\"  Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
   3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   6 .TH W 1 "Mar 19, 2004"
   7 .SH NAME
   8 w \- display information about currently logged-in users
   9 .SH SYNOPSIS
  10 .LP
  11 .nf
  12 \fBw\fR [\fB-hlsuw\fR] [\fIuser\fR]
  13 .fi
  14 
  15 .SH DESCRIPTION
  16 .sp
  17 .LP
  18 The \fBw\fR command displays a summary of the current activity on the system,
  19 including what each user is doing. The heading line shows the current time, the
  20 length of time the system has been up, the number of users logged into the
  21 system, and the average number of jobs in the run queue over the last 1, 5 and
  22 15 minutes.
  23 .sp
  24 .LP
  25 The fields displayed are: the user's login name, the name of the tty the user
  26 is on, the time of day the user logged on (in \fIhours:minutes\fR), the idle
  27 time\(emthat is, the number of minutes since the user last typed anything (in
  28 \fIhours:minutes\fR), the \fBCPU\fR time used by all processes and their
  29 children on that terminal (in \fIminutes:seconds\fR), the \fBCPU\fR time used
  30 by the currently active processes (in \fIminutes:seconds\fR), and the name and
  31 arguments of the current process.
  32 .SH OPTIONS
  33 .sp
  34 .LP
  35 The following options are supported:
  36 .sp
  37 .ne 2
  38 .na
  39 \fB\fB-h\fR\fR
  40 .ad
  41 .RS 6n
  42 Suppresses the heading.
  43 .RE
  44 
  45 .sp
  46 .ne 2
  47 .na
  48 \fB\fB-l\fR\fR
  49 .ad
  50 .RS 6n
  51 Produces a long form of output, which is the default.
  52 .RE
  53 
  54 .sp
  55 .ne 2
  56 .na
  57 \fB\fB-s\fR\fR
  58 .ad
  59 .RS 6n
  60 Produces a short form of output. In the short form, the tty is abbreviated, the
  61 login time and \fBCPU\fR times are left off, as are the arguments to commands.
  62 .RE
  63 
  64 .sp
  65 .ne 2
  66 .na
  67 \fB\fB-u\fR\fR
  68 .ad
  69 .RS 6n
  70 Produces the heading line which shows the current time, the length of time the
  71 system has been up, the number of users logged into the system, and the average
  72 number of jobs in the run queue over the last 1, 5 and 15 minutes.
  73 .RE
  74 
  75 .sp
  76 .ne 2
  77 .na
  78 \fB\fB-w\fR\fR
  79 .ad
  80 .RS 6n
  81 Produces a long form of output, which is also the same as the default.
  82 .RE
  83 
  84 .SH OPERANDS
  85 .sp
  86 .ne 2
  87 .na
  88 \fB\fIuser\fR\fR
  89 .ad
  90 .RS 8n
  91 Name of a particular user for whom login information is displayed. If
  92 specified, output is restricted to that user.
  93 .RE
  94 
  95 .SH EXAMPLES
  96 .LP
  97 \fBExample 1 \fRSample Output From the \fBw\fR Command
  98 .sp
  99 .in +2
 100 .nf
 101 example% \fBw\fR
 102 
 103 
 104 10:54am  up 27 day(s), 57 mins,  1 user,  load average: 0.28, 0.26, 0.22
 105 User        tty             login@    idle         JCPU    PCPU     what
 106 ralph    console  7:10am    1       10:05   4:31     w
 107 .fi
 108 .in -2
 109 .sp
 110 
 111 .SH ENVIRONMENT VARIABLES
 112 .sp
 113 .LP
 114 See  \fBenviron\fR(5) for descriptions of the following environment variables
 115 that affect the execution of \fBw\fR: \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and
 116 \fBLC_TIME\fR.
 117 .SH FILES
 118 .sp
 119 .ne 2
 120 .na
 121 \fB\fB/var/adm/utmpx\fR\fR
 122 .ad
 123 .RS 18n
 124 user and accounting information
 125 .RE
 126 
 127 .SH SEE ALSO
 128 .sp
 129 .LP
 130 \fBps\fR(1), \fBwho\fR(1), \fBwhodo\fR(1M), \fButmpx\fR(4),
 131 \fBattributes\fR(5), \fBenviron\fR(5)
 132 .SH NOTES
 133 .sp
 134 .LP
 135 The notion of the "current process" is unclear. The current algorithm is "the
 136 highest numbered process on the terminal that is not ignoring interrupts, or,
 137 if there is none, the highest numbered process on the terminal". This fails,
 138 for example, in critical sections of programs like the shell and editor, or
 139 when faulty programs running in the background fork and fail to ignore
 140 interrupts. In cases where no process can be found, \fBw\fR prints
 141 \fB\(mi\fR\&.
 142 .sp
 143 .LP
 144 The \fBCPU\fR time is only an estimate, in particular, if someone leaves a
 145 background process running after logging out, the person currently on that
 146 terminal is ``charged'' with the time.
 147 .sp
 148 .LP
 149 Background processes are not shown, even though they account for much of the
 150 load on the system.
 151 .sp
 152 .LP
 153 Sometimes processes, typically those in the background, are printed with null
 154 or garbaged arguments. In these cases, the name of the command is printed in
 155 parentheses.
 156 .sp
 157 .LP
 158 \fBw\fR does not know about the conventions for detecting background jobs. It
 159 will sometimes find a background job instead of the right one.