'\"macro stdmacro
.if n .pH g1.ps @(#)ps	40.9 of 12/19/89
'\" macro stdmacro
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.\"
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.nr X
.if \nX=0 .ds x} ps 1 "BSD Compatibility Package " "\&"
.if \nX=1 .ds x} ps 1 "BSD Compatibility Package "
.if \nX=2 .ds x} ps 1 "" "\&"
.if \nX=3 .ds x} ps "" "" "\&"
.TH \*(x}
.SH NAME
\f4ps\f1 \- display the status of current processes 
.SH SYNOPSIS
\f4/usr/ucb/ps\f1
[
\f4\-acglnrSuUvwx\f1
] [
\f4\-t\f2term\f1
] [
.I num
]
.SH DESCRIPTION
.P
The
\f4ps\f1
command displays information about processes.
Normally, only those processes that are running with your effective user
.SM ID
and are attached to a controlling terminal (see 
\f4termio\f1(4))
are shown.
Additional categories of processes
can be added to the display using various options.
In particular, the
\f4\-a\f1
option allows you to include processes that are not owned by you
(that do not have your user
.SM ID\s0),
and the
\f4\-x\f1
option allows you to
include processes without control terminals.
When you specify
both 
\f4\-a\f1
and 
\f4\-x\f1,
you get processes owned by anyone, with or without a control
terminal.
The
\f4\-r\f1
option restricts the list of processes printed to running
and runnable processes.
.P
\f4ps\f1
displays the process
.SM ID\s0,
under
.SM PID\s0;
the control terminal (if any), under
.SM TT\s0;
the cpu time used by the 
process so far, including both user and system time, under
.SM TIME\s0;
the state of the process, under S;
and finally, an indication of the 
.SM COMMAND
that is running.
.P
The state is given by a single letter from the
following:
.RS
.TP
.PD 0
\f4O\f1
Process is running on a processor.
.TP
\f4S\f1
Sleeping. 
Process is waiting for an event to complete.
.TP
\f4R\f1
Runnable.
Process is on run queue.
.TP
\f4I\f1
Idle.
Process is being created.
.TP
\f4Z\f1
Zombie state.
Process terminated and parent not waiting.
.TP
\f4T\f1
Traced.  
Process stopped by a signal because parent is tracing
it.
.TP
\f4X\f1
\f4SXBRK\fP
state.
Process is waiting for more primary memory.
.PD
.RE
.P
The following options must all be combined to form
the first argument:
.TP
\f4\-a\f1
Include information about processes owned by others.
.TP
\f4\-c\f1
Display the command name, as stored internally in the system for purposes
of accounting, rather than the command arguments, which are kept
in the process' address space.
This is more reliable, if less informative,
since the process is free to destroy the latter information.
.TP
\f4\-g\f1
Display all processes.
Without this option,
\f4ps\f1
only prints interesting processes.
Processes are deemed to be uninteresting if they are process group leaders.
This normally eliminates top-level command interpreters and processes
waiting for users to login on free terminals.
.TP
\f4\-l\f1
Display a long listing, with fields
\f4F\f1,
\f4PPID\f1,
\f4CP\f1,
\f4PRI\f1,
\f4NI\f1,
\f4SZ\f1,
\f4RSS\fP
and
\f4WCHAN\fP
as described below.
.TP
\f4\-n\f1
Produce numerical output for some fields.
In a user listing, the
\f4USER\fP
field is replaced by a
\f4UID\fP
field.
.TP
\f4\-r\f1
Restrict output to running and runnable processes.
.TP
\f4\-S\f1
Display accumulated
.SM CPU
time used by this process and all of its reaped 
children.
.TP
\f4\-u\f1
Display user-oriented output.
This includes fields
\f4USER\f1,
\f4SZ\f1,
\f4RSS\fP
and
\f4START\fP
as described below.
.TP
\f4\-U\f1
Update a private database where
\f4ps\f1
keeps system information.
.TP
\f4\-v\f1
Display a version of the output containing virtual memory.
This includes fields
\f4SIZE\fP
and
\f4RSS\f1,
described below.
.TP
\f4\-w\f1
Use a wide output format (132 columns rather than 80); if repeated,
that is,
\f4\-ww\f1,
use arbitrarily wide output.
This information is used to decide how much of long commands to print.
.TP
\f4\-x\f1
Include processes with no controlling terminal.
.br
.ne 8
.TP
\f4\-t\f2term\f1
List only process data associated with the
terminal,
.IR term .
Terminal identifiers may be specified in one of two
forms:  the device's file name
(for example, 
\f4tty04\f1
or
\f4term/14\f1)
or, if the device's file name starts with 
\f4tty\f1,
just the digit identifier
(for example,
\f404\f1).
.TP
.I num
A process number may be given, in which case the output
is restricted to that process.
This option must be supplied last.
.SH "DISPLAY FORMATS"
.P
Fields that are not common to all output formats:
.TP 12
\f4USER\fP
Name of the owner of the process.
.TP
\f4NI\fP
Process scheduling increment
[see \f4getpriority\f1(3) and \f4nice\f1(3C)].
.TP
.PD 0
\f4SIZE\fP
.TP
\f4SZ\fP
The combined size of the data and stack segments (in kilobyte units)
.PD
.TP
\f4RSS\fP
Real memory (resident set) size of the process (in kilobyte units).
.TP
\f4UID\fP
Numerical user-\s-1ID\s0 of process owner.
.TP
\f4PPID\fP
Numerical
.SM ID
of parent of process.
.TP
\f4CP\fP
Short-term
.SM CPU
utilization factor (used in scheduling).
.TP
\f4PRI\fP
The priority of the process (higher numbers
mean lower priority).
.TP
\f4START\fP
The starting time of the process, given in hours,
minutes, and seconds.
A process begun more than 24 hours before
the
\f4ps\f1
inquiry is executed
is given in months and days.
.TP
\f4WCHAN\fP
The address of an event for which the process is
sleeping,
or in
\f4SXBRK\fP
state
(if blank, the process is running).
.TP
\f4F\f1
Flags (hexadecimal and additive) associated with the process:
.RS
.PD 0
.TP
\f400\f1
Process has terminated.
Process table now available.
.TP
\f401\f1
A system process, always in primary memory.
.TP
\f402\f1
Parent is tracing process.
.TP
\f404\f1
Tracing parent's signal has stopped process.
Parent is waiting, see
\f4ptrace\f1(2).
.TP
\f408\f1
Process is currently in primary memory.
.TP
\f410\f1
Process currently in primary memory, locked until an
event is completed.
.PD
.RE
.P
A process that has exited and has a parent, but has not
yet been waited for by the parent is marked
\f1<\f4defunct\f1>;
otherwise,
\f4ps\f1
tries to determine the command name and arguments
given when the process was created by examining the
user block.
.SH FILES
.PD 0
.TP 20
\f4/dev\f1
.TP
\f4/dev/sxt/*\f1
.TP
\f4/dev/tty*\f1
.TP
\f4/dev/xt/*\f1
terminal
\f1(\f4tty\f1)
names searcher files
.TP
\f4/dev/kmem\f1
kernel virtual memory
.TP
\f4/dev/swap\f1
default swap device
.TP
\f4/dev/mem\f1
memory
.TP
\f4/etc/passwd\f1
.SM UID
information supplier
.TP
\f4/etc/ps_data\f1
internal data structure
.PD
.SH "SEE ALSO"
\f4getpriority\f1(3),
\f4nice\f1(3C)
.P
\f4kill\fP(1)
in the \f2User's Reference Manual\f1.
.br
\f4whodo\fP(1)
in the \f2System Administrator's Reference Manual\f1.
.br
\f4lseek\fP(2)
in the \f2Programmer's Reference Manual\f1.
.SH NOTES
.P
Things can change while
\f4ps\f1
is running; the picture it gives is only a close approximation to the
current state.
Some data printed for defunct processes is irrelevant.
.P
If no
.I term
or
.I num
is specified,
\f4ps\f1
checks the standard input, the standard output, and
the standard error in that order, looking for the
controlling terminal and will attempt to report on
processes associated with the controlling terminal.
In this situation, if the standard input, the standard
output, and the standard error are all redirected,
\f4ps\f1
will not find a controlling terminal,
so there will be no report.
.P
On a heavily loaded system,
\f4ps\f1
may report an
\f4lseek\f1(2)
error and exit.
\f4ps\f1
may seek to an invalid user area address, having
obtained the address of process' user area,
\f4ps\f1
may not be able to seek to that address before the
process exits and the address becomes invalid.
