DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

w(C)


w, uptime -- display information about who is on the system and what they are doing

Syntax

w [ -hlqtwx ] [ -n namelist ] [ -u utmpfile | -U utmpxfile ]
[ users ... ]

uptime

Description

The w command prints a summary of the current activity on the system, including what each user is doing.

The uptime command and the heading line on the w command are the same and show the current time of day, how long the system has been up, the number of users logged onto the system, and load averages. Load averages are shown as three numbers, reflecting an average over 1, 5, and 15 minute intervals. By default, load averages reflect the number of processes in the run queue. On SCO OpenServer Release 5.0.5 and later releases, you can set the system so that the load averages also include running processes; see below.

The options for the w command are:


-h
Do not print the heading or title lines.

-l
Long format (default): for each user, w outputs the user's login name, the terminal or pseudo terminal the user is currently using, when the user logged onto the system, the number of minutes the user has been idle (how much time has expired since the user last typed anything), the CPU time used by all processes and their children attached to the terminal, the CPU time used by the currently active process, and the name and arguments of the currently active process.

-n namelist
The argument is taken as the name of an alternate namelist (/unix is the default). This option is preserved for backward compatibility with pre-SCO OpenServer operating systems. For SCO OpenServer, this option applies only when no /dev/table/* files are found on the system, which should never happen.

-q
Quick format: for each user, w outputs the user's login name, the terminal or pseudo terminal the user is currently using, the number of minutes the user has been idle, and the name of the currently active process.

-t
Only the heading line is output (equivalent to uptime).

-u utmpfile
The file utmpfile is used instead of /etc/utmp as a record of who is currently logged in. This option cannot be used with the -x option.

-U utmpxfile
The file utmpxfile is used instead of /etc/utmpx. This option can only be used if the -x option is also specified.

-w
Both the heading line and the summary of users is output.

-x
Print out the hostname. This option cannot be used with the -u option.

-X
Print out full hostnames. This option implies the -x option. Hostnames printed by the -x option are truncated to fit into a field; hostnames printed by the -X option are not truncated.
If any users are specified, the user summary is restricted to reporting on these.

The load average shows the number of processes on the run queue; by default, it does not include running processes. In SCO OpenServer Release 5.0.5 and later releases, you can set the count_onproc kernel variable to also include running processes in this calculation.

When the load average includes only processes waiting to run (count_onproc set to 0, the default), it is a measure of unsatisfied demand for the CPU. To clarify, consider a one CPU system executing one process that is running continuously (such as calculating the value of pi to a billion digits). If count_onproc is set to 0, the load average is 0 because no processes are waiting for the CPU. If you had two such processes, the load average would be 1, indicating that one process was running and one was waiting for the CPU. If the system is idle most of the time with one process that runs occasionally, the load average stays at 0.

You can patch the link kit, the linked kernel, or kernel memory after boot to set count_onproc to 1, so running processes are included in the load average calculation along with processes on the run queue. One way to set this value to 1 on SCO OpenServer Release 5.0.6 and later is to use the scodb(ADM) command:

   echo 'count_onproc=1' | /etc/scodb -w
If count_onproc is set to 1, the load average reflects both satisfied and unsatisfied CPU demand. This means that the single pi calculation process yields a load average of 1.0; two such processes yield a load average of 2.0. A quiet system with sporadic CPU use shows up as some small number such as 0.04.

When count_onproc is set to 0, a load average of 0 on a 4-CPU machine can mean anything from zero CPU activity to one process on each CPU, each spinning continuously. With count_onproc set to 1, a totally idle system registers a load average of 0 and a 4-CPU system with one process spinning on each CPU registers a load average of 4.

Differences between versions

The calculation of load averages changed in SCO OpenServer Release 5.0.5. In SCO OpenServer Release 5.0.4 and earlier releases, processes that were sleeping at a very high priority were counted in the load average even though they were completely inactive. This is a vestige of the original BSD load average code.

Including inactive processes such as some quiet NFS server processes, sdd, and dlpid in the load averages yielded false load averages. The characteristic symptom of this problem was a flat integer load average on a seemingly idle system, as in the following:

   1:10pm   up 211 days, 14:22,   51 users,   load average: 1.00, 1.00, 1.00
To get a list of such miscounted processes that are excluded from the load average calculation in SCO OpenServer Release 5.0.5 and later releases, run the following command:
   ps -elf | awk '$7 > 77 && $10 > 0'
This shows processes that would be falsely counted into the load average on SCO OpenServer Release 5.0.4 and earlier systems but are excluded from the count on SCO OpenServer Release 5.0.5 and later releases. Note that this command does not catch processes running at realtime priorities higher than 25 even though they are falsely counted in older releases.

The count_onproc variable that can be set to 1 to include running processes in the load average calculation as well as processes on the run queue is available only in SCO OpenServer Release 5.0.5 and later releases.

Limitations

The ``currently active process'' is only an approximation and is not always correct. Pipelines can produce strange results, as can some background processes. If w is completely unable to guess at the currently active process, it prints ``-''. This usually indicates that there are stale entries in the utmp file which records logins. Stale utmp entries are sometimes left when a user logs out and for some reason, the entries were not erased from the file. The reasons this happens are complex and varied, but do not generally indicate anything seriously wrong.

Authorization

The behavior of these utilities is affected by assignment of the mem authorization On systems installed with ``high'' security, this is usually reserved for system administrators. If you do not have this authorization, the output will be restricted to data about your activities. Refer to ``Using a secure system'' in the Operating System User's Guide for more details.

Files

Used if none of the -u, -U, -x, or -X are given:

/etc/utmp
login database

Used if the -x or -X flags are given and the -u and -U flags are not given:


/etc/utmpx
extended version of /etc/utmp

Used by default:


/dev/table/proc
device special file access to kernel process table

/dev/table/avenrun
device special file access to kernel load average

Used only if /dev/table/proc or /dev/table/avenrun are inaccessible:


/unix
text file of usual booted kernel

/dev/kmem
device special file access to kernel memory

See also

date(C), finger(C), ps(C), tab(HW), uptime(C), utmp(F), utmpx(F), who(C), whodo(C)

Standards conformance

w and uptime are not part of any currently supported standard.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003