w: Show Who’s Logged On & What They’re Doing in UNIX, Linux

w displays information about the users currently on the machine, and their processes. The header shows, in this order, the current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes. The following entries are displayed for each user: login name, the tty name, the remote host, login time, idle time, JCPU, PCPU, and the command line of their current process. The JCPU time is the time used by all processes attached to the tty. It does not include past background jobs, but does include currently running background jobs. The PCPU time is the time used by the current process, named in the “what” field.

COMMAND-LINE OPTIONS

-h: Don’t print the header.

# w -h
root     pts/0     17May10 372days  0.01s  0.01s -bash
root     pts/2     17May10 372days  0.02s  0.02s -bash
root     pts/3     17May10 372days  0.03s  0.03s -bash
root     pts/1     18:05    2:01m   0.09s  0.08s  bash
root     pts/5     20:21    0.00s   0.03s  0.01s  w -h
itsiti   pts/8     19May10 370days  0.11s  0.11s -tcsh
root     pts/10    19May10 370days  0.01s  0.01s -bash
oraadm   pts/12    19May10 370days  0.12s  0.12s -tcsh

-u: Ignores the username while figuring out the current process and cpu times.

# w -u
 20:34:29 up 372 days, 11:13,  8 users,  load average: 0.60, 0.23, 0.15
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0     17May10 372days  0.01s  0.01s -bash
root     pts/2     17May10 372days  0.02s  0.02s -bash
root     pts/3     17May10 372days  0.03s  0.03s -bash
root     pts/1     18:05    2:03m   0.09s  0.08s  bash
root     pts/5     20:21    0.00s   0.04s  0.01s  w -u
itsiti   pts/8     19May10 370days  0.11s  0.11s -tcsh
root     pts/10    19May10 370days  0.01s  0.01s -bash
oraadm   pts/12    19May10 370days  0.12s  0.12s -tcsh

-s: Use the short format.  Don’t print the login time, JCPU or PCPU times.

 # w -s
 20:34:55 up 372 days, 11:14,  8 users,  load average: 0.71, 0.29, 0.17
USER     TTY         IDLE WHAT
root     pts/0     372days -bash
root     pts/2     372days -bash
root     pts/3     372days -bash
root     pts/1       2:03m  bash
root     pts/5       0.00s  w -s
itsiti   pts/8     370days -tcsh
root     pts/10    370days -bash
oraadm   pts/12    370days -tcsh

-f: Toggle printing the from (remote hostname) field.

The default as released is for the from field to not be printed, although your system administrator or distribution maintainer may have compiled a version in which the from field is shown by default.

# w -f
 20:35:14 up 372 days, 11:14,  8 users,  load average: 0.67, 0.30, 0.18
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    -                17May10 372days  0.01s  0.01s -bash
root     pts/2    -                17May10 372days  0.02s  0.02s -bash
root     pts/3    -                17May10 372days  0.03s  0.03s -bash
root     pts/1    10.3.100.100     18:05    2:04m   0.09s  0.08s  bash
root     pts/5    10.3.100.100     20:21    0.00s   0.05s  0.01s  w -f
itsiti   pts/8    -                19May10 370days  0.11s  0.11s -tcsh
root     pts/10   -                19May10 370days  0.01s  0.01s -bash
oraadm   pts/12   -                19May10 370days  0.12s  0.12s -tcsh

user: Show information about the specified user only.

 # w root
 20:35:45 up 372 days, 11:14,  8 users,  load average: 0.47, 0.29, 0.18
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0     17May10 372days  0.01s  0.01s -bash
root     pts/2     17May10 372days  0.02s  0.02s -bash
root     pts/3     17May10 372days  0.03s  0.03s -bash
root     pts/1     18:05    2:04m   0.09s  0.08s  bash
root     pts/5     20:21    0.00s   0.05s  0.01s  w root
root     pts/10    19May10 370days  0.01s  0.01s -bash

You May Also Like

Leave a Reply?