ps - report process status
ps [ options ]
ps prints information about active processes. Without options,
information is printed about processes associated with the controlling
terminal. The output consists of a short listing containing only the
process ID, terminal identifier, cumulative execution time, and the
command name. Since a batch job doesn't have a controlling terminal,
invoking ps without options from a batch job will result in an error.
Otherwise, the information that is displayed is controlled by the
selection of options.
options accept names or lists as arguments. Arguments can be either
separated from one another by commas or enclosed in double quotes and
separated from one another by commas or spaces. Values for proclist and
grplist must be numeric.
The options are:
-a Print information about all processes most frequently
requested: all those except process group leaders and
processes not associated with a terminal.
-A Print information about every process now running.
-c Print information about the scheduler properties. (See
-d Print information about all processes except process group
-e Print information about every process now running
(equivalent to -A).
-f Generate a full listing. (See below for significance of
columns in a full listing.)
-g grplist List only process data whose process group leader's ID
numbers appear in grplist. (A group leader is a process
whose process ID number is identical to its process group ID
number. A login shell is a common example of a process
-G grplist List only process data whose real group leader's ID numbers
appears in grplist.
-j Print session ID and process group ID.
-l Generate a long listing. (See below.)
-M If the system supports Mandatory Access Control, print the
security label for each process. The -M option can be
automatically be turned on by using an environmental
variable LABELFLAG. Set variable to on (not case sensitive)
for automatic security label information. To turn off
feature set to off or NULL.
-n name This argument is obsolete and is no longer used.
-o format Print information according to the format specification
given in format. (See below.)
-P If the system supports capabilities then print the
capabilities of each process.
-p proclist List only process data whose process ID numbers are given in
-s sesslist List information on all session leaders whose IDs appear in
-t termlist List only process data associated with the terminal given in
termlist. Terminal identifiers consist of the device's name
(for example, ttyd1, ttyq1).
-T List data for individual kernel threads. Normally the
information presented is a summation across all threads of
the process. This is of use when examining POSIX threaded
-u uidlist List only process data whose user ID number or login name is
given in uidlist. In the listing, the numerical user ID is
printed unless you give the -f option, which prints the
-U uidlist List only process data whose real user ID number or login
name is given in uidlist.
Under the -f option, ps tries to determine the command name and arguments
given when the process was created by examining the user block. Failing
this, the command name is printed, as it would have appeared without the
-f option, in square brackets.
The column headings and the meaning of the columns in a ps listing are
given below. The letters f and l indicate the option (full or long,
respectively) that causes the corresponding heading to appear (assuming
the -o option is not specified); all means that the heading always
appears. Note that these options determine only what information is
provided for a process; they do not determine which processes are listed.
If the environment variable _XPG is defined and has a numeric value
greater than 0, ps operates in conformance with the X/Open XPG4
specifications. The format of the output of the -l option differs in
some details from the XPG format and backward compatibility mode. The
differences are explained in the table below.
F (l) Flags (hexadecimal and additive) associated with the
001 Process is a system (resident) process.
002 Process is being traced.
004 Stopped process has been given to parent via
008 Process is sleeping at a non-interruptible priority.
010 Process is in core.
020 Process user area is in core.
040 Process has enabled atomic operator emulation.
080 Process in stream poll or select.
100 Process is a kernel thread.
S (l) The state of the process:
0 Process is running on a processor.
S Process is sleeping, waiting for a resource.
R Process is running.
Z Process is terminated and parent not waiting
T Process is stopped.
I Process is in intermediate state of creation.
X Process is waiting for memory.
C Process is creating core image after error.
UID (f,l) The user ID number of the process owner (the login name is
printed under the -f option).
PID (all) The process ID of the process (this datum is necessary in
order to kill a process).
PPID (f,l) The process ID of the parent process.
PGID (j) Process group leader ID. This can be used with the -g
SID (j) Session ID. This can be used with the -s option.
CLS (c) Scheduling class. The values printed for CLS are two
character mnemonics for the scheduler class. RT indicates
real-time, TS indicates timeshare, B indicates batch, BC
indicates batch critical, WL indicate weightless and GN
indicates gang scheduled.
C (f,l) Processor utilization for scheduling. Not printed when
the -c option is used.
PRI (l) The priority of the process (higher numbers mean higher
priority). If the class of the process is WL, w is
displayed as the priority. If the process is scheduled via
miser(1) it may be b for batch or bc for batch critical.
NI (l) Nice value, used in priority computation. Not printed
when the -c option is used (see nice(1) and csh(1)). Only
processes in the time-sharing class have a nice value.
Processes in other scheduling classes have their two
letter class mnemonic printed in this field (refer to CLS
P (l) If the process is running, gives the number of processor
on which the process is executing. Contains an asterisk
otherwise. This is not displayed in X/OPEN XPG4
ADDR (l) The physical address of the process. This is only
displayed in X/OPEN XPG4 conformance mode.
SZ (l) Total size (in pages) of the process, including code,
data, shared memory, mapped files, shared libraries and
stack. Pages associated with mapped devices are not
counted. (Refer to sysconf(1) or sysconf(3C) for
information on determining the page size.)
RSS (l) Total resident size (in pages) of process. This includes
only those pages of the process that are physically
resident in memory. Mapped devices (such as graphics) are
not included. Shared memory (shmget(2)) and the shared
parts of a forked child (code, shared objects, and files
mapped MAP_SHARED) have the number of pages prorated by
the number of processes sharing the page. Two independent
processes that use the same shared objects and/or the same
code each count all valid resident pages as part of their
own resident size. The page size can either be 4096 or
16384 bytes as determined by the return value of the
getpagesize(2) system call. In general the larger page
size is used on systems where uname(1) returns "IRIX64".
This is not displayed in X/OPEN XPG4 conformance mode.
WCHAN (l) The name (or address if the name is unavailable) of an
event for which the process is sleeping, or in SXBRK
state, (if blank, the process is running).
STIME (f) The starting time of the process, given in hours, minutes,
and seconds. (A process begun more than twenty-four hours
before the ps inquiry is executed is given in months and
TTY (all) The controlling terminal for the process (the message, ?,
is printed when there is no controlling terminal).
TIME (all) The cumulative execution time for the process.
COMMAND(all) The command name (the full command name and its arguments
are printed under the -f option). A process that has
exited and has a parent, but has not yet been waited for
by the parent, is marked <defunct>.
The -o option allows the output format to be specified under user
The format specification must be a list of names presented as a single
argument, blank- or comma-separated. Each variable has a default header.
The default header can be overridden by appending an equals sign and the
new text of the header. The rest of the characters in the argument are
used as the header text. The fields specified are written in the order
specified on the command line and should be arranged in columns in the
output. The field widths are selected by the system to be at least as
wide as the header text (default or overridden value). If the header
text is null such as -o user=, the field width is at least as wide as the
default header text. If all header text fields are null, no header line
The following names are recognized:
ruser The real user ID of the process.
user The effective user ID of the process.
rgroup The real group UD of the process.
group The effective group ID of the process.
pid The decimal value of the process ID.
ppid The decimal value of the parent process ID.
pgid The decimal value of the process group ID.
pcpu The ratio of CPU time used recently to the CPU time available in
the same period, expressed as a percentage.
vsz The size of the process in (virtual) memory.
nice The decimal value of the system scheduling priority of the
time The cumulative CPU time of the process.
etime The elapsed time since the process was started.
stime The starting time of the process.
flag Flags associated with the process.
state The state of the process.
wchan The address of an event for which the process is waiting or
wname The name (or address if the name is unavailable) of an event for
which the process is waiting or sleeping.
util Processor utilization for scheduling.
uid The user ID number of the process owner.
cpu The processor process is currently executing on.
class The scheduling class of the process.
tty The name of the controlling terminal of the process (if any) in
the same format used by the who utility.
comm The name of the command being executed (argv value) as a
args The command with all its arguments as a string.
label The MAC label of the running process.
The file /tmp/.ps_data/.ps_data is used to improve the performance of ps
by caching kernel info, and some device information. It is recreated
when it is older (either the mtime or ctime) than /unix, or /dev, or when
a read error occurs on the file. ps runs noticeably slower when this
file isn't used, or needs to be recreated.
When the Share II package is installed and enabled, every process
acquires a new property: its attached lnode. The lnode is the kernel
structure that is used to store per-user resource and administration data
under Share II. Many processes can be attached to the same lnode.
An lnode contains a user's resource limits, including limits on memory
usage and `number of processes'. All the processes attached to an lnode
are collectively subject to the lnode's memory and process limits.
Each lnode is addressed by a unique key which is a UID number. When
given the -y option, ps reports each process's lnode attachment under the
`UID' column as a UID or login name.
/etc/passwd UID information supplier
internal data structure
capabilities(4), getty(1M), gr_osview(1), gr_top(1), kill(1), miser(1),
nice(1), sysconf(1), top(1), sched_setscheduler(2), sysconf(3C).
Things can change while ps is running; the snapshot it gives is only true
for a splitsecond, and it may not be accurate by the time you see it.
Some data printed for defunct processes is irrelevant.
If no termlist, proclist, uidlist, or grplist is specified, ps checks
stdin, stdout, and stderr in that order, looking for the controlling
terminal and attempts to report on processes associated with the
controlling terminal. In this situation, if stdin, stdout, and stderr
are all redirected, ps does not find a controlling terminal, so there is
ps -ef may not report the actual start of a tty login session, but rather
an earlier time, when a getty was last respawned on the tty line.
The C and ADDR fields currently always report 0. The output resulting
from using the format specification pcpu is also always 0.
When a machine's system time is corrected by timed or timeslave and if
the correction sets the time to an earlier value, ps reports a
meaningless huge or negative TIME value for the timed or timeslave
PPPPaaaaggggeeee 7777 [ Back ]