PS(1) BSD PS(1)
NAME
ps - process status
SYNOPSIS
ps [ aceglnstuvwxU# ] [ nodename ]
DESCRIPTION
ps prints information about processes. Normally, only your processes are
candidates to be printed by ps. Specifying the a option causes other
users' processes to be candidates to be printed. Specifying the x option
includes processes without control terminals in the candidate pool.
All output formats include, for each process, the process ID (PID),
control terminal of the process (TT), CPU time used by the process (TIME)
including both user and system time, the state of the process (STAT), and
an indication of what command is running (COMMAND).
The state is given by a sequence of four letters, e.g. RWNA. The first
letter indicates the runnability of the process: R for runnable
processes, T for stopped processes, P for processes in page wait, D for
those in disk (or other short term) waits, S for those sleeping for less
than about 20 seconds, and I for idle (sleeping longer than about 20
seconds) processes. The second letter indicates whether a process is
swapped out, showing W if it is, or a blank if it is loaded. A process
which has specified a soft limit on memory requirements and which is
exceeding that limit shows a greater-than character (>); such a process
is (necessarily) not swapped. The third letter indicates whether a
process is running with altered CPU scheduling priority, as under
nice(1). If the process priority is reduced, an N is shown; if the
process priority has been artificially raised, then a less-than character
(<) is shown. Processes running without special treatment have just a
blank.
OPTIONS
a Request information about all processes with terminals
(ordinarily only your own processes are displayed).
c Print the command name, as stored internally in the system for
purposes of accounting, rather than the command arguments,
which are kept in the process's address space. This is more
reliable, if less informative, since the process is free to
destroy the latter information.
e Print the environment as well as the arguments to the command.
g Ask for 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 log in on free terminals.
k Not supported in Domain/OS BSD.
l Ask for a long listing, with fields PPID, CP, PRI, NI, ADDR,
SIZE, RSS and WCHAN as described below.
n Produce numerical output. 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.
s Add the size SSIZ of the kernel stack of each process (for use
by system maintainers) to the basic output format.
tx Restrict output to processes whose controlling tty is x (which
should be specified as printed by ps, for example, t3 for tty3,
tco for console, td0 for ttyd0, t? for processes with no tty, t
for processes at the current tty, etc). This must be the last
option given.
u Produce a user oriented output, including the fields USER,
%CPU, NICE, SIZE, and RSS as described below.
v Produce a version of the output containing virtual memory
statistics, including the fields RE, SL, PAGEIN, SIZE, RSS,
LIM, TSIZ, TRS, %CPU and %MEM, described below.
w Use a wide output format (132 columns rather than 80). If
repeated, e.g., ww, use arbitrarily wide output. This
information is used to decide how much of long commands to
print.
x Ask about all processes, even those with no terminal.
U Update a private database where ps keeps system information.
Thus, the command ps U should be included in the /etc/rc file.
Domain/OS BSD does not support /etc/psdatabase.
# Restrict the output to the process whose process number is
specified (the process number is indicated here by the pound
sign, #). This option must also be last.
nodename Show information about processes running on the specified node.
VARIABLE OUTPUT FIELDS
Fields that are not common to all output formats are described below.
USER Name of the owner of the process
%CPU CPU utilization of the process; this is a decaying average over
up to a minute of previous (real) time. Since the time base
over which this is computed varies (since processes may be very
young), it is possible for the sum of all %CPU fields to exceed
100%.
NICE (or NI) Process scheduling increment (see setpriority(2))
SIZE Virtual size of the process (in 1024 byte units)
RSS Real memory (resident set) size of the process (in 1024 byte
units)
LIM Soft limit on memory used, specified via a call to
setrlimit(2); if no limit has been specified then shown as xx
TSIZ Size of text (shared program) image
TRS Size of resident (real memory) set of text
%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/O's resulting from references by the process
to pages not loaded in core.
UID Numerical user-ID of process owner
PPID Numerical ID of parent of process
CP Short-term CPU utilization factor (used in scheduling)
PRI Process priority (non-positive when in non-interruptible wait)
ADDR Swap address of the process
WCHAN Event on which process is waiting (an address in the system).
A symbol is chosen that classifies the address, unless
numerical output is requested (see the n flag). In this case,
the initial part of the address is trimmed off and is printed
hexadecimally, e.g., 0x80004000 prints as 4000.
F Flags associated with process as in <sys/proc.h>:
SLOAD 000001 in core
SSYS 000002 swapper or pager process
SLOCK 000004 process being swapped out
SSWAP 000008 save area flag
STRC 000010 process is being traced
SWTED 000020 another tracing flag
SULOCK 000040 user settable lock in core
SPAGE 000080 process in page wait state
SKEEP 000100 another flag to prevent swap out
SDLYU 000200 delayed unlock of pages
SWEXIT 000400 working on exiting
SPHYSIO 000800 doing physical i/o (bio.c)
SVFORK 001000 process resulted from vfork()
SVFDONE 002000 another vfork flag
SNOVM 004000 no vm, parent in a vfork()
SPAGI 008000 init data space on demand from inode
SANOM 010000 system detected anomalous vm behavior
SUANOM 020000 user warned of anomalous vm behavior
STIMO 040000 timing out during sleep
SDETACH 080000 detached inherited by init
SOUSIG 100000 using old signal mechanism
NOTES
A process that has exited and has a parent that has not yet waited for
the process is marked <defunct>. A process that is blocked trying to
exit is marked <exiting>. While ps makes an educated guess as to the
filename and arguments given when the process was created by examining
memory or the swap area, this method is inherently somewhat unreliable.
In any event a process is entitled to destroy this information, so the
names cannot be counted on too much.
BUGS
Things can change while ps is running; the picture it gives is only a
close approximation to reality.
FILES
/dev Searched to find tty names
SEE ALSO
kill(1), tb(1)