Learning Who Else is Logged in with w

Learning Who Else is Logged in with w

Another way to find out about other people logged into the Unix system is to use w, which tells you who is logged in, what they're doing, and a few other details (Code Listing 7.11).

To find out who is logged in with w:

  • w

    At the shell prompt, type w. You'll usually see output much like that in Code Listing 7.11. The top line shows

    • The time

    • System uptime in days, hours, and minutes (uptime is how long it's been since the system was restarted and is usually measured in weeks or months for Unix systems, as opposed to hours or days for personal computers).

    • The number of users

    • System load averages (the numbers indicate jobsprograms or scripts to executelined up to run in the past 1, 5, and 15 minutes)

Code Listing 7.11. The w command provides tons of information about the system and its users

[ejr@hobbes ejr]$ w   1:49pm up 6 days,        4:21,       6 users,  load average: 0.08, 0.02, 0.01 USER      TTY      FROM     LOGIN@      IDLE     JCPU     PCPU      WHAT ejr       tty1              Wed 7am     3:36m    7.07s    6.01s     -bash root      tty2              Wed 3pm     28:46m   1.22s    0.32s     -bash asr       tty4              1:32pm      17:22    1.04s    0.30s     pine deb       tty5              1:32pm      3.00s    1.22s    0.42s     lynx ejr       ttyp1    calvin   12:14pm     1:28m    1.33s    0.57s     vi hairyspiders ejr       ttyp0    calvin   1:02pm      1.00s    1.70s    0.24s     w [ejr@hobbes ejr]$ 

The following lines, one per logged-in user, show

  • The login name

  • The tty name (the connection to the host)

  • The remote host name

  • The login time

  • Current idle time (that is, the time since a key on the keyboard was touched)

  • JCPU (job CPU time, or the total processing time for jobs on the current connection, which is the tty, for those into the jargon)

  • PCPU (process CPU time, or the processing time for the current process)

  • The command line of the current process

Whew! As you can see from Code Listing 7.11 and Code Listing 7.12, different systems' w commands produce slightly different (but similar) output.


  • Use w with grep to find information (slightly more abbreviated) about a specific user. For example, w | grep ejr gives limited information, but just about a specific user. See Chapter 1 for more information about piping commands.

Code Listing 7.12. w yields different information on different systems.

xmission> w    1:47pm   up 38 day(s),  23:35,  36 users,  load average:  1.58, 1.78, 1.75 ... ejraypts/16  Thu 6am1:14     -csh ... 

Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net