'\" te
.\" Copyright (c) 2002, 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.
.TH PS 1B "May 26, 2006"
.SH NAME
ps \- display the status of current processes
.SH SYNOPSIS
.LP
.nf
\fB/usr/ucb/ps\fR [\fB-aceglnrSuUvwx\fR] [\fB-t\fR \fIterm\fR] [\fInum\fR]
.fi

.SH DESCRIPTION
.sp
.LP
The \fBps\fR command displays information about processes. Normally, only those
processes that are running with your effective user \fBID\fR and are attached
to a controlling terminal (see  \fBtermio\fR(7I)) are shown. Additional
categories of processes can be added to the display using various options. In
particular, the \fB-a\fR option allows you to include processes that are not
owned by you (that do not have your user \fBID\fR), and the \fB-x\fR option
allows you to include processes without controlling terminals. When you specify
both \fB-a\fR and \fB-x\fR, you get processes owned by anyone, with or without
a controlling terminal. The \fB-r\fR option restricts the list of processes
printed to running and runnable processes.
.sp
.LP
\fBps\fR displays in tabular form the process ID, under \fBPID\fR; the
controlling terminal (if any), under \fBTT\fR; the cpu time used by the process
so far, including both user and system time, under \fBTIME\fR; the state of the
process, under S; and finally, an indication of the \fBCOMMAND\fR that is
running.
.sp
.LP
The state is given by a single letter from the following:
.sp
.ne 2
.na
\fB\fBO\fR\fR
.ad
.RS 5n
Process is running on a processor.
.RE

.sp
.ne 2
.na
\fB\fBS\fR\fR
.ad
.RS 5n
Sleeping. Process is waiting for an event to complete.
.RE

.sp
.ne 2
.na
\fB\fBR\fR\fR
.ad
.RS 5n
Runnable. Process is on run queue.
.RE

.sp
.ne 2
.na
\fB\fBZ\fR\fR
.ad
.RS 5n
Zombie state. Process terminated and parent not waiting.
.RE

.sp
.ne 2
.na
\fB\fBT\fR\fR
.ad
.RS 5n
Traced. Process stopped by a signal because parent is tracing it.
.RE

.SH OPTIONS
.sp
.LP
The following options must all be combined to form the first argument:
.sp
.ne 2
.na
\fB\fB-a\fR\fR
.ad
.RS 11n
Includes information about processes owned by others.
.RE

.sp
.ne 2
.na
\fB\fB-c\fR\fR
.ad
.RS 11n
Displays the command name rather than the command arguments.
.RE

.sp
.ne 2
.na
\fB\fB-e\fR\fR
.ad
.RS 11n
Displays the environment as well as the arguments to the command.
.RE

.sp
.ne 2
.na
\fB\fB-g\fR\fR
.ad
.RS 11n
Displays all processes. Without this option, \fBps\fR 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.
.RE

.sp
.ne 2
.na
\fB\fB-l\fR\fR
.ad
.RS 11n
Displays a long listing, with fields \fBF\fR, \fBPPID\fR, \fBCP\fR, \fBPRI\fR,
\fBNI\fR, \fBSZ\fR, \fBRSS\fR, and \fBWCHAN\fR as described below.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.RS 11n
Produces numerical output for some fields. In a user listing, the \fBUSER\fR
field is replaced by a \fBUID\fR field.
.RE

.sp
.ne 2
.na
\fB\fB-r\fR\fR
.ad
.RS 11n
Restricts output to running and runnable processes.
.RE

.sp
.ne 2
.na
\fB\fB-S\fR\fR
.ad
.RS 11n
Displays accumulated \fBCPU\fR time used by this process and all of its reaped
children.
.RE

.sp
.ne 2
.na
\fB\fB-t\fR \fIterm\fR\fR
.ad
.RS 11n
Lists only process data associated with the terminal, \fIterm\fR. Terminal
identifiers may be specified in one of two forms:  the device's file name (for
example,  \fBtty04\fR or \fBterm/14\fR ) or, if the device's file name starts
with  \fBtty\fR, just the digit identifier (for example, \fB04\fR).
.RE

.sp
.ne 2
.na
\fB\fB-u\fR\fR
.ad
.RS 11n
Displays user-oriented output. This includes fields \fBUSER\fR, \fB%CPU\fR,
\fB%MEM\fR, \fBSZ\fR, \fBRSS\fR, and \fBSTART\fR as described below.
.RE

.sp
.ne 2
.na
\fB\fB-U\fR\fR
.ad
.RS 11n
Obsolete. This option no longer has any effect. It causes \fBps\fR to exit
without printing the process listing.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 11n
Displays a version of the output containing virtual memory. This includes
fields \fBSIZE\fR, \fB%CPU\fR, \fB%MEM\fR, and \fBRSS\fR, described below.
.RE

.sp
.ne 2
.na
\fB\fB-w\fR\fR
.ad
.RS 11n
Uses a wide output format, that is, 132 columns rather than 80. If the option
letter is repeated, that is, \fB-ww\fR, this option uses arbitrarily wide
output. This information is used to decide how much of long commands to print.
\fBNote:\fR The wide output option can be viewed only by a superuser or the
user who owns the process.
.RE

.sp
.ne 2
.na
\fB\fB-x\fR\fR
.ad
.RS 11n
Includes processes with no controlling terminal.
.RE

.sp
.ne 2
.na
\fB\fInum\fR\fR
.ad
.RS 11n
A process number may be given, in which case the output is restricted to that
process. This option must be supplied last.
.RE

.SH DISPLAY FORMATS
.sp
.LP
Fields that are not common to all output formats:
.sp
.ne 2
.na
\fB\fBUSER\fR\fR
.ad
.RS 9n
Name of the owner of the process.
.RE

.sp
.ne 2
.na
\fB\fB%CPU\fR\fR
.ad
.RS 9n
\fBCPU\fR use of the process. This is a decaying average over up to a minute of
previous (real) time.
.RE

.sp
.ne 2
.na
\fB\fBNI\fR\fR
.ad
.RS 9n
Process scheduling increment (see \fBgetpriority\fR(3C) and \fBnice\fR(3UCB)).
.RE

.sp
.ne 2
.na
\fB\fBSIZE\fR\fR
.ad
.RS 9n
The total size of the process in virtual memory, including all mapped files and
devices, in kilobyte units.
.RE

.sp
.ne 2
.na
\fB\fBSZ\fR\fR
.ad
.RS 9n
Same as \fBSIZE\fR.
.RE

.sp
.ne 2
.na
\fB\fBRSS\fR\fR
.ad
.RS 9n
Real memory (resident set) size of the process, in kilobyte units.
.RE

.sp
.ne 2
.na
\fB\fBUID\fR\fR
.ad
.RS 9n
Numerical user-ID of process owner.
.RE

.sp
.ne 2
.na
\fB\fBPPID\fR\fR
.ad
.RS 9n
Numerical \fBID\fR of parent of process.
.RE

.sp
.ne 2
.na
\fB\fBCP\fR\fR
.ad
.RS 9n
Short-term \fBCPU\fR utilization factor (used in scheduling).
.RE

.sp
.ne 2
.na
\fB\fBPRI\fR\fR
.ad
.RS 9n
The priority of the process (higher numbers mean lower priority).
.RE

.sp
.ne 2
.na
\fB\fBSTART\fR\fR
.ad
.RS 9n
The starting time of the process, given in hours, minutes, and seconds. A
process begun more than 24 hours before the \fBps\fR inquiry is executed is
given in months and days.
.RE

.sp
.ne 2
.na
\fB\fBWCHAN\fR\fR
.ad
.RS 9n
The address of an event for which the process is sleeping (if blank, the
process is running).
.RE

.sp
.ne 2
.na
\fB\fB%MEM\fR\fR
.ad
.RS 9n
The ratio of the process's resident set size to the physical memory on the
machine, expressed as a percentage.
.RE

.sp
.ne 2
.na
\fB\fBF\fR\fR
.ad
.RS 9n
Flags (hexadecimal and additive) associated with the process. These flags are
available for historical purposes; no meaning should be currently ascribed to
them.
.RE

.sp
.LP
A process that has exited and has a parent, but has not yet been waited for by
the parent, is marked <\fBdefunct\fR>\|; otherwise, \fBps\fR tries to determine
the command name and arguments given when the process was created by examining
the user block.
.SH FILES
.sp
.LP
\fB/dev/tty*\fR
.sp
.ne 2
.na
\fB\fB/etc/passwd\fR\fR
.ad
.RS 15n
\fBUID\fR information supplier
.RE

.SH SEE ALSO
.sp
.LP
\fBkill\fR(1), \fBps\fR(1), \fBwhodo\fR(1M), \fBgetpriority\fR(3C),
\fBnice\fR(3UCB), \fBproc\fR(4), \fBattributes\fR(5), \fBtermio\fR(7I)
.SH NOTES
.sp
.LP
Things can change while \fBps\fR is running. The picture \fBps\fR gives is only
a close approximation to the current state. Some data printed for defunct
processes is irrelevant.