.TH ps "" "" Command
.PC "Print process status"
\fBps [\-][adefglmnrtwx] [\-c \fIsys\^\fB] [\fImem\^\fB] [\-p\fIpid\fB,\fIpid\fB,...,\fIpid\^]\fR
.PP
.HS
.SH Options:
.IC \fB\-a\fR
Print all terminals' processes
.IC "\fB\-c\fI sys\fR"
This option does nothing; it is included to preserve the integrity of
some shell scripts
.IC \fB\-d\fR
Print status of loadable drivers
.IC \fB\-e\fR
Same as \fB\-a\fR; included for compatibility
.IC \fB\-f\fR
Put `-' in null fields for placeholders
.IC \fB\-g\fR
Give group leader for this process
.IC "\fB\-k\fI mem\fR"
Next argument is memory image (default, \fB/dev/mem\fR)
.IC \fB\-l\fR
Print long format
.IC \fB\-m\fR
This option does nothing; it is included to preserve the integrity of
some shell scripts
.IC \fB\-n\fR
No header line
.IC "\-p\fIpid\fB,\fIpid\fB,...,\fIpid\fR"
Print information for each \fIpid\fR in the list
.IC \fB\-r\fR
Give the real size of the process
.IC \fB\-t\fR
Print CPU times
.IC \fB\-w\fR
Wide column format (132 columns instead of default 80)
.IC \fB\-x\fR
Print processes with no controlling tty
.HE
.B ps
prints information about a process or processes.
It prints the information in fields, followed by the command name and arguments.
The fields include the following:
.IP \fBTTY\fR 0.75i
The controlling terminal of the command, printed in short form.
For example, ``tty44:'' means
.BR /dev/tty44 .
A dash means there is no controlling terminal.
.IP \fBPID\fR
Process id; necessary to know when the process is to be killed.
.IP \fBGROUP\fR
PID of the group leader of the process, that is,
the shell that started up when the user logged in.
.IP \fBPPID\fR
PID of the parent of the process; very often a shell.
.IP \fBUID\fR
User id or name of the owner.
.IP \fBK\fR
Size of the process, in kilobytes.
.IP \fBF\fR
Process flag bits, as follows:
.DS
.ta 0.8i 1.4i
\fBPFCORE\fR	00001	Process is in core
\fBPFLOCK\fR	00002	Process is locked in core
\fBPFSWIO\fR	00004	Swap I/O in progress
\fBPFSWAP\fR	00010	Process is swapped out
\fBPFWAIT\fR	00020	Process is stopped (not waited)
\fBPFSTOP\fR	00040	Process is stopped (waited on)
\fBPFTRAC\fR	00100	Process is being traced
\fBPFKERN\fR	00200	Kernel process
\fBPFAUXM\fR	00400	Auxiliary segments in memory
\fBPFDISP\fR	01000	Dispatch at earliest convenience
\fBPFNDMP\fR	02000	Command mode forbids dump
\fBPFWAKE\fR	04000	Wakeup requested
.DE
.IP \fBS\fR
State of the process, as follows:
.DS
\fBR\fR	Ready to run (waiting for CPU time)
\fBS\fR	Stopped for other reasons (I/O completion, pause, etc.)
\fBT\fR	Being traced by another process
\fBW\fR	Waiting for an existent child
\fBZ\fR	Zombie (dead, but parent not waiting)
.DE
.IP \fBEVENT\fR
The condition that the process is anticipating.
This not applicable if the process is ready to run.
The following gives the legal symbolic names of events.
If a driver does not support symbolic event names,
.B ps
prints a unique hexadecimal number instead:
.DS
.ta 1.0i
\fISystem Sleeps:\fR
\fBbpwait\fR	Wait for a buffer to become valid
\fBbufneed\fR	Wait for a free buffer to become available
\fBbwrite\fR	Wait for a buffer write to finish
\fBioreq\fR	An IO request is being processed
\fBpause\fR	This process is in the \fBpause()\fR system call
\fBpipe data\fR	Wait for data to appear in a pipe
\fBpipe wx\fR	
\fBpoll\fR	Wake for polled event, poll timeout, or signal
\fBptrace\fR	Send a \fBptrace\fR command to a traced child
\fBptret\fR	Wait for signal processing in a traced child to complete
\fBpwrite\fR	Wait for a pipe to empty enough for a write
\fBswap\fR	Wait for a process to get swapped in
\fBwait\fR	Wait for a child to terminate
\fBwaitq\fR	Wait for more character queues to become available
.DE
.DS
.ta 1.0i
\fIDriver Sleeps\fR
\fBaha:ccb\fR	AHA-154x driver is waiting for a SCSI command to complete
\fBnkbcmd\fR
\fBnkbcmd...\fR
\fBnkbcmd2\fR
\fBnkbcmd2...\fR	\fBnkb\fR is waiting for a command to complete 
\fBptycd\fR	Pseudoterminal driver is waiting for carrier
\fBptyread\fR	Pseudoterminal driver is waiting for a read
\fBptywrite\fR	Pseudoterminal driver is waiting for a write
\fBttydrain\fR	Line discipline is waiting for a tty to drain
\fBttyiodrn\fR	\fBioctl()\fR asked line discipline to let tty output drain
\fBttyoq\fR	Line discipline is waiting for an output queue to drain
\fBttywait\fR	Line discipline is waiting for more data
.DE
.IP "\fBCVAL SVAL IVAL RVAL\fR"
Scheduling information; bigger is better.
.IP \fBUTIME\fR
Time consumed while running in the program (in seconds).
.IP \fBSTIME\fR
Time consumed while running in the system (in seconds).
.PP
Normally,
.B ps
displays the
.B TTY
and
.B PID
fields of each active process started on the
caller's terminal, as well as the command name and arguments.
The following flags alter this behavior.
.IP \fB\-a\fR
Display information about processes started from all terminals.
.IP "\fB\-c \fIsys\fR"
This option does nothing; it is included to preserve the integrity of
some shell scripts.
.IP \fB\-d\fR
Print information about status of loadable drivers.
.IP \fB\-e\fR
Same as \fB\-a\fR.
This is included for compatibility with other implementation of
.BR ps .
.IP \fB\-f\fR
Blank fields have \*(Ql\-\*(Qr place-holders.
This enables field-oriented commands like
.B sort
and
.B awk
to process the output.
.IP \fB\-g\fR
Print the group leader field GROUP if the \fBl\fR option is given.
.IP "\fB\-k \fImem\fR"
The next argument
.I mem
is the memory image (default,
.BR /dev/mem ).
Note that this argument currently does nothing; it is included only to
preserve old shell scripts.
.II /dev/ps
The \*(CO implementation of
.B ps
reads information from
.BR /dev/ps .
This permits
.B ps
to be smaller and faster, helps to avoid ``ghosts,'' and to be atomic.
.IP \fB\-l\fR
Long format.
In addition to the TTY and PID fields, prints the PPID, UID, K, F, S and
EVENT fields.
.IP \fB\-m\fR
This option does nothing; it is included to preserve the integrity of
some shell scripts.
.IP \fB\-n\fR
Suppress the header line.
.IP "\fB\-p\fIpid\fB,\fIpid\fB,...,\fIpid\fR"
Print information for each process identifier
.I pid
in the comma-separated list.
.IP \fB\-r\fR
Print the real size of the process, which includes the user and auxiliary
segments assigned to the process.
Because the user segment (usually 1 kilobyte) is shared by all processes owned
by that user, this may give a misleading total size for all the user's
processes.
.IP \fB\-t\fR
Print elapsed CPU time fields UTIME and STIME.
.IP \fB\-w\fR
Wide format output; print 132 columns instead of 80.
.IP \fB\-x\fR
Display processes which do not have a controlling terminal.
.RE
.SH Files
\fB/dev/ps\fR \(em Device for a system driver
.br
\fB/dev/tty*\fR \(em List of terminal names
.SH "See Also"
.Xr "commands," commands
.Xr "hmon," hmon
.Xr "kill," kill.c
.Xr "mem," mem
.Xr "ps \fR[device driver]\fB," ps.d
.Xr "size," size
.Xr "wait" wait.c
.SH Notes
Each process can modify or destroy its command name and arguments.
The state of the system changes even as
.B ps
runs.
