PS(1) USER COMMANDS PS(1)
NAME
ps - display the status of current processes
SYNOPSIS
ps [ [-]acCegjklnrSuUvwx ][ -tx ]|[ num ]
[ kernel-name ] [ c-dump-file ] [ swap-file ]
DESCRIPTION
ps displays information about processes. Normally, only
those processes that are running with your effective user ID
and are attached to a controlling terminal (see termio(4))
are shown. Additional categories of processes can be added
to the display using various options. In particular, the -a
option allows you to include processes that are not owned by
you (that do not have your user ID), and the -x option
allows you to include processes without control terminals.
When you specify both -a and -x, you get processes owned by
anyone, with or without a control terminal. The -r option
restricts the list of processes printed to "running"
processes: runnable processes, those in page wait, or those
in short-term non-interruptible waits.
ps displays the process ID, under PID; the control terminal
(if any), under TT; the cpu time used by the process so far,
including both user and system time), under TIME; the state
of the process, under STAT; and finally, an indication of
the COMMAND that is running.
The state is given by a sequence of four letters, for exam-
ple, `RWNA'.
First letter indicates the runnability of the process:
R Runnable processes.
T Stopped processes.
P Processes in page wait.
D Processes in non-interruptible waits;
typically short-term waits for disk
or NFS I/O.
S Processes sleeping for less than
about 20 seconds.
I Processes that are idle (sleeping
longer than about 20 seconds).
Z Processes that have terminated and
that are waiting for their parent
process to do a wait(2V) ("zombie"
processes).
Second letter indicates whether a process is swapped out;
blank Represented as a SPACE character, in
this position indicates that the pro-
cess is loaded (in memory).
W Process is swapped out.
> Process has specified a soft limit on
memory requirements and has exceeded
that limit; such a process is (neces-
sarily) not swapped.
Third letter indicates whether a process is running with
altered CPU scheduling priority (nice(1)):
blank Represented as a SPACE character, in
this position indicates that the pro-
cess is running without special
treatment.
N The process priority is reduced,
< The process priority has been raised
artificially.
Fourth letter indicates any special treatment of the pro-
cess for virtual memory replacement. The
letters correspond to options to the vad-
vise(2) system call. Currently the possibil-
ities are:
blank Represented as a SPACE character, in
this position stands for VA_NORM.
A Stands for VA_ANOM. An A typically
represents a program which is doing
garbage collection.
S Stands for VA_SEQL. An S is typical
of large image processing programs
that are using virtual memory to
sequentially address voluminous data.
kernel-name specifies the location of the system namelist.
If the -k option is given, c-dump-file tells ps where to
look for the core dump. Otherwise, the core dump is located
in the file /vmcore and this argument is ignored. swap-file
gives the location of a swap file other than the default,
/dev/drum.
OPTIONS
Options must all be combined to form the first argument.
-a Include information about processes owned by others.
-c Display the command name, as stored internally in the
system for accounting purposes, rather than the command
arguments, which are kept in the process address space.
This is more reliable, if less informative, as the pro-
cess is free to destroy the latter information.
-C Display raw CPU time instead of the decaying average in
the %CPU field.
-e Display the environment as well as the arguments to the
command.
-g Display all processes. Without this option, ps prints
only "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 termi-
nals.
-j Display a listing useful for job control information,
with fields PPID, PID, PGID, SID, TT, TPGID, STAT, UID,
TIME, and COMMAND as described below.
With this option, the STAT field has three additional
letters:
C indicates the process does not want SIGCHLD when a
child changes state done to job control.
E The process has completed an exec, and the parent
can no longer change the process group of this
process.
O The process is an orphan, with no parent process
to handle job control signals.
-k Normally, kernel-name defaults to /vmunix, c-dump-file
is ignored, and swap-file defaults to /dev/drum. With
the -k option in effect, these arguments default to
/vmunix, /vmcore, and /dev/drum, respectively.
-l Display a long listing, with fields F, PPID, CP, PRI,
NI, SZ, RSS, and WCHAN, as described below.
-n Produce numeric output for some fields. In a long
listing, the WCHAN field is printed numerically rather
than symbolically, or, in a user listing, the USER
field is replaced by a UID field.
-r Restrict output to "running" processes.
-S Display accumulated CPU time used by this process and
all of its reaped children.
-u Display user-oriented output. This includes fields
USER, %CPU, %MEM, SZ, RSS and START as described below.
-U Update a private database where ps keeps system infor-
mation. Include `ps -U' in the /etc/rc file.
-v Display a version of the output describing virtual
memory information. This includes fields RE, SL,
PAGEIN, SIZE, RSS, LIM, %CPU and %MEM, described below.
-w Use a wide output format (132 columns rather than 80);
if repeated, that is, -ww, use arbitrarily wide output.
This information is used to decide how much of long
commands to print.
-x Include processes with no controlling terminal.
The following two options are mutually exclusive. When
specified, these options must appear immediately following
the last option.
-tx Restrict output to processes whose controlling terminal
is x (which should be specified as printed by ps; for
example, t3 for /dev/tty3, tco for /dev/console, td0
for /dev/ttyd0, t? for processes with no terminal,
etc). This option must be the last one given.
num A process number may be given, in which case the output
is restricted to that process. This option must also
be last, and must appear with no white space between it
and the previous option.
DISPLAY FORMATS
Fields that are not common to all output formats:
USER Name of the owner of the process.
%CPU CPU use of the process; this is a decaying aver-
age over up to a minute of previous (real) time.
Because the time base over which this is com-
puted varies (since processes may be very young)
it is possible for the sum of all %CPU fields to
exceed 100%.
NI Process scheduling increment (see getpriority(2)
and nice(3V)).
SIZE
SZ The combined size of the data and stack segments
(in kilobytes)
RSS Real memory (resident set) size of the process
(in kilobytes).
LIM Soft limit on memory used, specified using a
call to getrlimit(2); if no limit has been
specified, this is shown as xx.
%MEM Percentage of real memory used by this process.
RE Residency time of the process (seconds in core).
SL Sleep time of the process (seconds blocked).
PAGEIN Number of disk I/Os resulting from references by
the process to pages not loaded in core.
UID Numeric user-ID of process owner.
PPID Numeric ID of parent of process.
SID Numeric ID of the session to which the process
belongs. SID = PGID = PID indicates a session
leader.
PGID Numeric ID of the process group of the process.
TPGID Numeric ID of the process group associated with
the terminal specified under TT (distinguished
process group, see termio(4)).
CP Short-term CPU utilization factor (used in
scheduling).
PRI Process priority (non-positive when in non-
interruptible wait).
START Time the process was created if today, or the
date it was created if before today.
WCHAN Event on which process is waiting (an address in
the system). A symbol is chosen that classifies
the address, unless numeric output is requested
(see the n flag). In this case, the address is
printed in hexadecimal.
F Flags (in hex) associated with process as in
:
SLOAD 00000001 in core
SSYS 00000002 swapper or pager process
SLOCK 00000004 process being swapped out
SSWAP 00000008 save area flag
STRC 00000010 process is being traced
SWTED 00000020 parent has been told that
this process stopped
SULOCK 00000040 user can set lock in core
SPAGE 00000080 process in page wait state
SKEEP 00000100 another flag to prevent
swap out
SOMASK 00000200 restore old mask after
taking signal
SWEXIT 00000400 working on exiting
SPHYSIO 00000800 doing physical I/O
SVFORK 00001000 process resulted from
vfork()
SVFDONE 00002000 another vfork flag
SNOVM 00004000 no vm, parent in a vfork()
SPAGI 00008000 init data space on demand,
from vnode
SSEQL 00010000 user warned of sequential
vm behavior
SUANOM 00020000 user warned of anomalous
vm behavior
STIMO 00040000 timing out during sleep
SORPHAN 00080000 process is orphaned
STRACNG 00100000 process is tracing another
process
SOWEUPC 00200000 process is being profiled
and has a pending count increment
SSEL 00400000 selecting; wakeup/waiting
danger
SFAVORD 02000000 favored treatment in
swapout and pageout
SLKDONE 04000000 record-locking has been
done
STRCSYS 08000000 tracing system calls
SNOCLDSTOP 10000000 SIGCHLD not sent when
child stops
SEXECED 20000000 process has completed
an exec
SRPC 40000000 sunview window locking
A process that has exited and has a parent, but has not yet
been waited for by the parent, is marked ; a pro-
cess that is blocked trying to exit is marked ;
otherwise, ps makes an educated guess as to the file name
and arguments given when the process was created by examin-
ing memory or the swap area.
ENVIRONMENT
The environment variables LC_CTYPE, LANG, and LC_default
control the character classification throughout ps. On
entry to ps, these environment variables are checked in the
following order: LC_CTYPE, LANG, and LC_default. When a
valid value is found, remaining environment variables for
character classification are ignored. For example, a new
setting for LANG does not override the current valid charac-
ter classification rules of LC_CTYPE. When none of the
values is valid, the shell character classification defaults
to the POSIX.1 "C" locale.
FILES
/vmunix system namelist
/dev/kmem kernel memory
/dev/drum swap device
/vmcore core file
/dev searched to find swap device and
/etc/psdatabase system namelist, device, and wait chan-
nel information
SEE ALSO
kill(1), w(1), getpriority(2), getrlimit(2), wait(2V), vad-
vise(2), nice(3V), termio(4), locale(5), pstat(8)
BUGS
Things can change while ps is running; the picture it gives
is only a close approximation to the current state.
Sun Release 4.1 Last change: 2 October 1989
REPORTS
Analyize In-Line NAC strategies and products.
ANALYTICS Plan and design your enterprise blade server deployments
InformationWeek U.S. IT Salary Survey 2008
Salaries for business technology professionals are falling. Here's what you need to know in order to make good hiring decisions and personal career choices. Download Today