PS(1) — USER COMMANDS
NAME
ps − process status
SYNOPSIS
ps [ acegklstuvwx# ]
DESCRIPTION
Ps displays information about processes. Normally, only processes that you have started are candidates to be displayed by ps, but see the OPTIONS section below for how to get more information. Specifying a makes other users’ processes candidates to be displayed; specifying x 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 (this includes both user and system time), the state STAT of the process, and an indication of the COMMAND which is running.
The state is given by a sequence of four letters, for example, ‘RWNA’.
First letterindicates the runnability of the process:
RRunnable processes,
TStopped processes,
PProcesses in page wait,
DProcesses in disk (or other short term) waits,
SProcesses sleeping for less than about 20 seconds,
IProcesses which are idle (sleeping longer than about 20 seconds).
Second letter
indicates whether a process is swapped out;
blank
(that is, a space) in this position indicates that the process is loaded (in memory).
WProcess is swapped out.
>Process has specified a soft limit on memory requirements and has exceeded that limit shows; such a process is (necessarily) not swapped.
Third letter
indicates whether a process is running with altered CPU scheduling priority (nice):
blank
(that is, a space) in this position indicates that the process is running without special treatment.
NThe process priority is reduced,
<The process priority has been raised artificially.
Fourth letter
indicates any special treatment of the process for virtual memory replacement. The letters correspond to options to the vadvise(2) system call. Currently the possibilities are:
blank
(that is, a space) in this position stands for VA_NORM.
AStands for VA_ANOM. An A typically represents a program which is doing garbage collection.
SStands for VA_SEQL. An S is typical of large image processing programs which are using virtual memory to sequentially address voluminous data.
OPTIONS
a Display information about all processes with terminals (ordinarily only one’s own processes are displayed).
c 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.
e Display the environment as well as the arguments to the command.
g Display all processes. Without this option, ps 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.
k Use the file /vmcore in place of /dev/kmem and /dev/mem. This is used for postmortem system debugging.
l Display a long listing, with fields PPID, CP, PRI, NI, ADDR, SIZE, RSS and WCHAN as described below.
s Adds 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, etc). This option must be the last one given.
u Display user-oriented output. This includes fields USER, %CPU, NICE, SIZE, and RSS as described below.
v Display a version of the output containing virtual memory. This includes 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, that is, ww, use arbitrarily wide output. This information is used to decide how much of long commands to print.
x Display even those processes with no terminal.
# A process number may be given, (indicated here by #), in which case the output is restricted to that process. This option must also be last.
A second argument tells ps where to look for core if the k option is given, instead of /vmcore. A third argument is the name of a swap file to use instead of the default /dev/drum. If a fourth argument is given, it is taken to be the file containing the system’s namelist. Otherwise, /vmunix is used.
DISPLAY FORMATS
Fields which are not common to all output formats:
USERname of the owner of the process
%CPUcpu 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) and nice(3C).
SIZEvirtual size of the process (in 1024 byte units)
RSSreal memory (resident set) size of the process (in 1024 byte units)
LIMsoft limit on memory used, specified via a call to getrlimit(2); if no limit has been specified then shown as xx
TSIZsize of text (shared program) image
TRSsize of resident (real memory) set of text
%MEMpercentage of real memory used by this process.
REresidency time of the process (seconds in core)
SLsleep time of the process (seconds blocked)
PAGEINnumber of disk i/o’s resulting from references by the process to pages not loaded in core.
UIDnumerical user-id of process owner
PPIDnumerical id of parent of process
CPshort-term cpu utilization factor (used in scheduling)
PRIprocess priority (non-positive when in non-interruptible wait)
ADDRswap address of the process
WCHANevent on which process is waiting (an address in the system), with the initial part of the address trimmed off, for example, 80004000 prints as 4000.
Fflags associated with process as in <sys/proc.h>:
SLOAD0000001in core
SSYS0000002swapper or pager process
SLOCK0000004process being swapped out
SSWAP0000008save area flag
STRC0000010process is being traced
SWTED0000020another tracing flag
SULOCK0000040user settable lock in core
SPAGE0000080process in page wait state
SKEEP0000100another flag to prevent swap out
.
SOMASK0000200restore old mask after taking signal
SWEXIT0000400working on exiting
SPHYSIO0000800doing physical i/o (bio.c)
SVFORK0001000process resulted from vfork()
SVFDONE0002000another vfork flag
SNOVM0004000no vm, parent in a vfork()
SPAGI0008000init data space on demand, from inode
.
SSEQL0010000user warned of sequential vm behavior
SUANOM0020000user warned of anomalous vm behavior
STIMO0040000timing out during sleep
.
SOUSIG0100000using old signal mechanism
SOWEUPC0200000owe process an addupc() call at next ast
SSEL0400000selecting; wakeup/waiting danger
SLOGIN0800000a login process (legit child of init)
SPTECHG1000000pte’s for process have changed
A process that has exited and has a parent, but has not yet been waited for by the parent is marked <defunct>; a process which is blocked trying to exit is marked <exiting>; ps makes an educated guess as to the file name and arguments given when the process was created by examining memory or the swap area. The method is inherently somewhat unreliable and in any event a process is entitled to destroy this information, so the names cannot be counted on too much.
FILES
/vmunixsystem namelist
/dev/kmemkernel memory
/dev/drumswap device
/vmcorecore file
/devsearched to find swap device and tty names
SEE ALSO
BUGS
Things can change while ps is running; the picture it gives is only a close approximation to reality.
Sun Release 1.1 — Last change: 19 March 1984