ps Command
Purpose
Shows status of processes. This document describes the standard AIX® ps command and the System V version of the ps command.
Syntax
- X/Open Standards
- Berkeley Standards
Description
The ps command writes the status of active processes and if the
-m flag is given, displays the associated kernel threads to standard output.
While the -m flag displays threads associated with processes by using extra
lines, you must use the -o flag with the THREAD
field specifier to
display extra thread-related columns.
Without flags, the ps command displays information about the current terminal. The -f, -o, l, -l, s, u, and v flags only determine how much information is provided about a process; they do not determine which processes are listed. The l, s, u, and v flags are mutually exclusive.
With the -o flag, the ps command examines memory or the paging area and determines what the command name and parameters were when the process was created. If the ps command cannot find this information, the command name that is stored in the kernel is displayed in square brackets.
The COLUMNS
environment variable overrides the system-selected,
horizontal screen size.
The command-line flags that accept a list of parameters (the -o, -G, -g, -p, -t, -U, and -u flags) are limited to 128 items. For example, the -u Ulist flag can specify no more than 128 users.
For cases in which the output of the ps command does not include workload partition (WPAR) names but does include Project IDs
(PROJECT
), user IDs (UID
or USER
), or group IDs
(GID
) associated with a process running within a workload partition under the
current operating environment, the IDs are preceded by a plus sign (+) to indicate the association
with a workload partition. Each workload partition contains its own definition of users,
groups, and project IDs that can be different from the IDs defined for the global environment. The
-@ option can be specified to include workload partition names in the output.
Depending on the flags used with the ps command, column headings are displayed above the information that is displayed to standard output. The headings are defined in the following list and the flags that cause these headings to be displayed are shown in parentheses:
- ADDR
- (-l and l flags) Contains the segment number of the process stack, if normal; if a kernel process, the address of the preprocess data area.
- BND
- (-o THREAD flag) The logical processor number of the processor to which the kernel thread is bound if any. For a process, this field is displayed if all its threads are bound to the same processor.
- C
- (-f, l, and -l flags) CPU
utilization of a process or thread, which is incremented each time the system clock ticks and the
process or thread is found to be running. The value is decayed by the scheduler by dividing it by 2
once per second. For the
sched_other
policy, CPU utilization is used in determining process scheduling priority. Large values indicate a CPU intensive process and result in less process priority, whereas small values indicate an I/O intensive process and result in a more favorable priority. - CMD
- (-f, -l, and l flags) Contains the command name. Under the -f flag, the ps command tries to determine the current command name and arguments, both of which can be changed asynchronously by the process. These are then displayed. If this fails, the command name is written as it would appear without the -f option in square brackets.
- COMMAND
- (s, u, and v) Contains the command name. The full command name and its
parameters are displayed with the -f flag. F Field Table
Flags Hexadecimal Value Definition SLOAD
0x00000001 Indicates that the process is operating in core memory. SNOSWAP
0x00000002 Indicates that the process cannot be swapped out. STRC
0x00000008 Indicates that the process is being traced. SWTED
0x00000010 Indicates that the process stopped while being traced. SFWTED
0x00000020 Indicates that the process stopped after a call to the fork
subroutine, while being traced.SEWTED
0x00000040 Indicates that the process stopped after a call to the exec
subroutine, while being traced.SLWTED
0x00000080 Indicates that the process stopped after a call to the load
orunload
subroutine, while being traced.SFIXPRI
0x00000100 Indicates that the process has a fixed priority, ignoring the pcpu
field descriptor.SKPROC
0x00000200 Indicates a Kernel process. SOMASK
0x00000400 Indicates restoration of the old mask after a signal is received. SWAKEONSIG
0x00000800 Indicates that the signal aborts the sleep
subroutine. The contents must not be equal to those of thePCATCH
flag. The contents of bothPCATCH
andSWAKEONSIG
must be greater than those ofPMASK
.SUSER
0x00001000 Indicates that the process is in user mode. SLKDONE
0x00002000 Indicates that the process is done locked. STRACING
0x00004000 Indicates that the process is a debugging process. SMPTRACE
0x00008000 Indicates multi-process debugging. SEXIT
0x00010000 Indicates that the process is exiting. SSEL
0x00020000 Indicates that the processor is selecting: makeup or waiting danger. SORPHANPGRP
0x00040000 Indicates an orphaned process group. SNOCNTLPROC
0x00080000 Indicates that the session leader relinquished the controlling terminal. SPPNOCLDSTOP
0x00100000 Indicates that the SIGHLD
signal is not sent to the parent process when a child stops.SEXECED
0x00200000 Indicates that the process has. SJOBSESS
0x00400000 Indicates that job control was used in the current session. SJOBOFF
0x00800000 Indicates that the process is free from job control. PSIGDELIVERY
0x01000000 Indicates that the process is used by the program-check handler. SRMSHM
0x02000000 Indicates that the process removed shared memory during a call to the exit
subroutine.SSLOTFREE
0x04000000 Indicates that the process slot is free. SNOMSG
0x08000000 Indicates that there are no more uprintf
subroutine messages. - WPAR
- (-@ flag) Contains the workload partition name. Under the -@ flag, the ps command displays the name of the workload partition in which the process is running. Specify the -@ flag with the wparname parameter to display the process information.
- DPGSZ
- (Z flag) The data page size of the process.
F
- (-l and l flags) Some of the more important
F
field flags (hexadecimal and additive) associated with processes and threads are listed in the following table:F Field TableFlags Hexadecimal Value Definition SLOAD
0x00000001 Indicates that the process is operating in core memory. SNOSWAP
0x00000002 Indicates that the process cannot be swapped out. STRC
0x00000008 Indicates that the process is being traced. SKPROC
0x00000200 Indicates a kernel process. SEXIT
0x00010000 Indicates that the process is exiting. SLPDATA
0x00020000 Indicates that the process uses large pages. SEXECED
0x00200000 Indicates that the process has. SEXECING
0x01000000 Indicates that the process is execing (performing an exec). SPSEARLYALLOC
0x04000000 Indicates that paging space for this process is allocated early. TKTHREAD
0x00001000 Indicates that the thread is a kernel-only thread. Note: You can see the definitions of all process and thread flags by consulting thep_flags
andt_flags
fields in the /usr/include/sys/proc.h and /usr/include/sys/thread.h files respectively.
- LIM
- (v flag) The soft limit on memory used, specified through a call to the
setrlimit
subroutine. If the limit has not been specified, thenxx
is displayed. If the limit is set to the system limit (unlimited), a value ofUNLIM
is displayed. - NI
- (-l and l flags) The nice value; used in calculating priority for the
sched other
policy. - PID
- (all flags) The process ID of the process.
- PGIN
- (v flag) The number of disk I/Os resulting from references by the process to pages not loaded in core.
- PPID
- (-f, l, and -l flags) The process ID of the parent process.
- PRI
- (-l and l flags) The priority of the process or kernel thread; higher numbers mean less priority.
- PROJECT
- (-P flag) Project name that is assigned to the process. Under the current
operating environment, the
PROJECT
andUSER
fields are not converted to names for processes running within a workload partition. The -U and -u flags only apply to the current operating environment, unless the -@ flag is included with a specific workload partition name. If the -@ flag is used to specify a workload partition other than the current operating environment, and the -U and -u flags are specified, the list of user IDs must be numeric. - RSS
- (v flag) The real-memory (resident set) size of the process (in 1 KB units).
- S
- (-l and l flags) The state of the process or kernel
thread:
For processes:
O
- Nonexistent
A
- Active
W
- Swapped
I
- Idle (waiting for startup)
Z
- Canceled
T
- Stopped
For kernel threads:
O
- Nonexistent
R
- Running
S
- Sleeping
W
- Swapped
Z
- Canceled
T
- Stopped
SC
- (-o THREAD flag) The suspended count of the process or kernel thread. For a process, the suspended count is defined as the sum of the kernel threads suspend counts.
SCH
- (-o THREAD, sched flag) The scheduling policy for a kernel thread. The
policies
sched_other
,sched_fifo
, andsched_rr
are respectively displayed by using:0
,1
,2
. The scheduling policies are displayed only when asched
flag is specified. SIZE
- (v flag) The virtual size of the data section of the process (in 1 KB units).
SHMPGSZ
- (Z flag) The shared memory page size of the process.
SPGSZ
- (Z flag) The stack page size of the process.
SSIZ
- (s flag) The size of the kernel stack. This value is always 0 (zero) for a multi-threaded process.
STAT
- (s, u, and v flags) Contains the state of the process:
0
- Nonexistent
A
- Active
I
- Intermediate
Z
- Canceled
T
- Stopped
K
- Available kernel process
- STIME
- (-f and u flags) The starting time of the process. The
LANG
environment variables control the appearance of this field. - SUBPROJ
- (-P flag) Subproject Identifier that is assigned to the process.
- SZ
- (-l and l flags) The size in 1 KB units of the core image of the process.
- THCNT
- (-o thcount flag) The number of kernel threads owned by the process.
- TID
- (-o THREAD flag) The thread ID of the kernel thread.
- TIME
- (all flags) The total runtime for the process. The time is displayed in the format of mm:ss or mmmm:ss if the runtime reaches 100 minutes, which is different from the displayed format if you use the -o time flag.
- TPGSZ
- (Z flag) The text page size of the process.
- TRS
- (v flag) The size of resident-set (real memory) of text.
- TSIZ
- (v flag) The size of text (shared-program) image.
TTY
- (all flags) The controlling terminal for the process:
-
- The process is not associated with a terminal.
?
- Unknown.
- Number
- The
TTY
number. For example, the entry2
indicatesTTY2
.
- UID
- (-f, -l, and l flags) The user ID of the process owner. The login name is printed under the -f flag.
- USER
- (u flag) The login name of the process owner. Under the current operating
environment, the
PROJECT
andUSER
fields are not converted to names for processes running within a workload partition. - WCHAN
- (-l flag) The event for which the process or kernel thread is waiting or sleeping. For a kernel thread, this field is blank if the kernel thread is running. For a process, the wait channel is defined as the wait channel of the sleeping kernel thread if only one kernel thread is sleeping; otherwise a star is displayed.
- WCHAN
- (l flag) The event on which the process is waiting (an address in the system). A symbol that classifies the address is selected, unless a numerical output is requested.
- %CPU
- (u and v flags) The percentage of time the process
has used the CPU since the process started. This value is computed by dividing the time that the
process uses the CPU by the elapsed time of the process. In a multi-processor environment, the value
is further divided by the number of available CPUs because several threads in the same process can
run on different CPUs at the same time. (Because the time base over which this data is computed
varies, the sum of all
%CPU
fields can exceed 100%.) - %MEM
- (u and v flags) The percentage of real memory that is
used by this process. The
%MEM
value tends to exaggerate the cost of a process that is sharing program text with other processes. It does not account for times when multiple copies of a program are run and a copy of the program text is shared by all instances. The size of the text section is accounted for in every instance of the program. This means that if several copies of a program are run, the total%MEM
value of all processes might exceed 100%.
<defunct>
. A process that is blocked by trying to exit is marked
<exiting>
. The ps command attempts to determine the file
name and arguments that are given when the process was created by memory or by the swap area. - The process can change while the ps command is running. Some data that is displayed for defunct processes is irrelevant.
- The ps program examines the memory to retrieve the file name and arguments that are used when the process was created. However, a process can destroy information, making this method of retrieving file name and arguments unreliable.
- The ps program searches the local resources for users and group information.
Flags
The following flags are preceded by a -
(minus sign):
Item | Description |
---|---|
-A | Writes to standard output information about all processes. |
-a | Writes to standard output information about all processes, except the session leaders and processes not associated with a terminal. |
-c Clist | Displays only information about processes that are assigned to the workload management classes listed in the Clist variable. The Clist variable is either a comma-separated list of class names or a list of class names that are enclosed in double quotation marks (" "), which is separated from one another by a comma or by one or more spaces, or both. |
-d | Writes information to standard output about all processes, except the session leaders. |
-e | Writes information to standard output about all processes, except kernel processes. |
-F Format | Same as the -o Format |
-f | Generates a full listing. |
-G Glist | Writes information to standard output only about processes that are in the effective groups
that are listed for the Glist variable. The Glist variable is
either a comma-separated list of effective group identifiers, or a list of effective group
identifiers enclosed in double quotation marks (" ") and separated from one another
by a comma or by one or more spaces. |
-g Glist | Writes information to standard output only about processes that are in the process groups
that are listed for the Glist variable. The Glist variable is
either a comma-separated list of process group identifiers or a list of process group identifiers
that are enclosed in double quotation marks (" ") and separated from one another by
a comma or by one or more spaces. |
-k | Lists kernel processes. |
-l | Generates a long listing. Also see the l flag. |
-L pidlist | Generates a list of descendants of every pid that has been passed to it in the pidlist variable. The pidlist variable is a list of comma-separated process IDs. The list of descendants from all the given pid is printed in the order in which they appear in the process table. |
-M | Lists all 64-bit processes. |
-m | Lists kernel threads and processes. Output lines for processes are followed by an extra
output line for each kernel thread. This flag does not display thread-specific fields
(bnd , scount , sched , thcount ,
and tid ), unless the appropriate -o Format flag is specified. |
-N | Gathers no thread statistics. With this flag, ps reports those statistics that can be obtained by not traversing through the threads chain for the process. |
-n NameList | Specifies an alternative system name-list file in place of the default. The operating system does not use the -n flag because information is supplied directly to the kernel. |
-o Format | Displays information in the format that is specified by the Format
variable. Multiple field specifiers can be specified for the Format variable. The
Format variable is either a comma-separated list of field specifiers or a list of
field specifiers that are enclosed within a set of " " (double-quotation marks) and separated from
one another by a comma or by one or more spaces, or both. Each field
specifier has a default header. The default header can be overridden by appending an
The following field specifiers are recognized by the system:
|
-o Continued |
|
-o Continued |
Otherwise, multiple fields in a specified format can be displayed by the Format variable, including field descriptors. If field descriptors are used in the Format variable, it must be enclosed in double quotation marks (" "). The following table shows how field descriptors correspond to field specifiers: |
Each field specifier has a default header. The default header can be overridden by appending an
equal sign (=) followed by the user-defined text for the header. The fields are written in the order
that is specified on the command-line in column format. The field widths are specified by the system
to be at least as wide as the default or user-defined header text. If the header text is null (for
example, |
|
Following is the mapping between the default headers and various field specifiers. Every entry in
the Default Header column can be overridden by appending an equal sign (=) to the corresponding
entry in the Field specifier followed by the user-defined text for the header.
|
|
-p Plist | Displays only information about processes with the process numbers that are specified for the Plist variable. The Plist variable is either a comma-separated list of process ID numbers or a list of process ID numbers that are enclosed in double quotation marks (" ") and separated from one another by a comma or by one or more spaces, or both. |
-P | Displays the Project name, Project origin, and subproject identifier for the
project. If the stick bit is set for the process, the project name is preceded by an asterisk (*)
character. The Project origin field designates the currently loaded project
repository (LOCAL or LDAP). |
-t Tlist | Displays only information about processes that are associated with the controlling ttys that is listed in the Tlist variable. The Tlist variable is either a comma-separated list of tty identifiers or a list of tty identifiers that are enclosed in double quotation marks (" ") and separated from one another by a comma or by one or more spaces, or both. |
-T pid | Displays the process hierarchy that is rooted at a given pid in a tree format by using ASCII art. This flag can be used with the -f, -F, -o, and -l flags. |
-u Ulist | This flag is equivalent to the -U Ulist flag. The -u flag only applies to the current operating environment unless the -@ flag is also specified. If the -@ flag is used to specify a workload partition other than the current operating environment and the -u flag is specified, the list of user IDs must be numeric. |
-U Ulist | Displays only information about processes with the user ID numbers or login names that are specified for the Ulist variable. The Ulist variable is either a comma-separated list of user IDs or a list of user IDs enclosed in double quotation marks (" ") and separated from one another by a comma and one or more spaces. The -U flag only applies to the current operating environment unless the -@ flag is also specified. If the -@ flag is used to specify a workload partition other than the current operating environment and the -U flag is specified, the list of user IDs must be numeric. In the listing, the ps command displays the numerical user ID unless the -f flag is used; then the command displays the login name. This flag is equivalent to the -u Ulist flag. See also the u flag. |
-X | Prints all available characters of each user/group name instead of truncating to the first eight characters. |
-Z | Displays the page size settings of processes.
|
-@ [ WparName ] | Displays the process information that is associated with the workload partition WparName. If you do not specify the WparName parameter, the process information for all workload partitions is displayed. Workload partition information is displayed for all processes. Specify other flags to the ps command to determine which process information to be displayed. |
Options
The following options are not preceded by a minus sign (-):
Item | Description |
---|---|
a |
Displays information about all processes with terminals (ordinarily only the own processes of the user are displayed). |
c |
Displays the command name, as stored internally in the system for purposes of accounting, rather than the command parameters, which are kept in the process address space. |
e |
Displays the environment and the parameters to the command, up to a limit of 80 characters. |
ew |
Wraps the display from the e flag one extra line. |
eww |
Wraps the display from the e flag and displays the ENV list until the flag
reaches the LINE_MAX value. |
ewww |
Wraps the display from the e flag and displays the ENV list
until the flag reaches the INT_MAX value. |
g |
Displays all processes. |
l | Displays a long listing having the F , s, UID , PID , PPID ,
C , PRI , NI , ADDR , SZ , PSS , WCHAN , TTY ,
TIME , and CMD fields. |
n |
Displays numerical output. In a long listing, the WCHAN field is printed numerically
rather than symbolically. In a user listing, the USER field is replaced by a UID
field. |
s | Displays the size (SSIZ ) of the kernel stack of each process (for use by
system maintainers) in the basic output format. This value is always 0 (zero) for a multi-threaded
process. |
t tty |
Displays processes whose controlling tty is the value of the tty
variable, which must be specified as printed by the ps command; that is,
0 for terminal /dev/tty/0 , lft0 for
/dev/lft0 , and pts/2 for /dev/pts/2 . |
u | Displays user-oriented output. This includes the USER , PID , %CPU ,
%MEM , SZ , RSS , TTY , STAT , STIME , TIME , and
COMMAND fields. |
v | Displays the PGIN , SIZE , RSS , LIM , TSIZ , TRS ,
%CPU , %MEM fields. |
w |
Specifies a wide-column format for output (132 columns rather than 80). If repeated, (for
example, ww) , uses arbitrarily wide output. This information is used to decide how
much of long commands to print. |
x |
Displays processes without a controlling terminal in addition to processes with a controlling terminal. |
X |
Prints the full user name or group name. The name is not truncated. |
Exit Status
This command returns the following exit values:
Item | Description |
---|---|
0 | Successful completion. |
>0 | An error occurred. |
Security
Attention RBAC users
: This command can perform privileged operations. Only
privileged users can run privileged operations. For more information about authorizations and
privileges, see Privileged Command Database in Security. For a list of privileges
and the authorizations that are associated with this command, see the lssecattr
command or the getcmdattr
subcommand.
Examples
- To display all processes, type:
ps -e -f
ps -X -e -f
- To list processes owned by specific users, type:
ps -f -l -ujim,jane,su
- To list processes that are associated with the
/dev/console
and/dev/tty1
ttys type:ps -t console,tty/1
- To list processes not associated with a terminal, type:
ps -t -
- To display a specified format with field specifiers, type:
The output is:ps -o ruser,pid,ppid=parent,args
RUSER PID parent COMMAND helene 34 12 ps -o ruser,pid,ppid=parent,args
- To display a specified format with field descriptors, type:
The output is:ps -o "< %u > %p %y : %a"
< RUSER > PID TT : COMMAND < helene > 34 pts/3 : ps -o < %u > %p %y : %a
- To display information about processes and kernel threads that are controlled
by the current terminal type:
The output is like:ps -lm
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 240003 A 26 8984 7190 1 60 20 2974 312 pts/1 0:00 -ksh 400 S - - - 1 60 - - - - - - 200005 A 26 9256 8984 15 67 20 18ed 164 pts/1 0:00 ps 0 R - - - 15 67 - - - - - -
- To display information about all processes and kernel threads, type:
The output is like:ps -emo THREAD
USER PID PPID TID S C PRI SC WCHAN FLAG TTY BND CMD jane 1716 19292 - A 10 60 1 * 260801 pts/7 - biod - - - 4863 S 0 60 0 599e9d8 8400 - - - - - - 5537 R 10 60 1 5999e18 2420 - 3 - luke 19292 18524 - A 0 60 0 586ad84 200001 pts/7 - -ksh - - - 7617 S 0 60 0 586ad84 400 - - - luke 25864 31168 - A 11 65 0 - 200001 pts/7 - - - - - 8993 R 11 65 0 - 0 - - -
- To list all the 64-bit processes, type:
ps -M
- To display the project assignment details for the processes, type:
ps -P
- To display the page size settings of the process, type:
The output is like:ps -Z
PID TTY TIME DPGSZ SPGSZ TPGSZ SHMPGSZ CMD 41856 pts/15 0:00 4K 4K 4K 64K ps 84516 pts/15 0:00 4K 4K 4K 64K ksh
Files
Item | Description |
---|---|
/usr /bin /ps |
Contains the ps command. |
Using the ps command in Performance management.
System V ps command
Syntax (System V)
Description (System V)
The ps command prints information about active processes. Without flags, ps prints information about processes that are associated with the controlling terminal. The output contains the process ID, terminal identifier, cumulative runtime, and the command name. The information that is displayed with flags varies accordingly.
- Output
-
Depending on the flags used with the ps command, column headings vary for the information displayed. The headings are defined in the following list (flags that cause these headings to appear are shown in parentheses):
- F (-l)
- Flags (hexadecimal and additive) associated with the process, or the thread if the
-L option is specified. Some of the more important
F
field flags (hexadecimal and additive) associated with processes and threads are shown after this:F Field TableFlags Hexadecimal Value Definition SLOAD
0x00000001 Indicates that the process is operating in core memory. SNOSWAP
0x00000002 Indicates that the process cannot be swapped out. STRC
0x00000008 Indicates that the process is being traced. SKPROC
0x00000200 Indicates a Kernel process. SEXIT
0x00010000 Indicates that the process is exiting. SEXECED
0x00200000 Indicates that the process has. SEXECING
0x01000000 Indicates that the process is execing (performing an exec). TKTHREAD
0x00001000 Indicates that the thread is a kernel only thread. Note: You can see the definitions of all process and thread flags by referring to thep_flags
andt_flags
fields in the/usr/include/sys/proc.h
and/usr/include/sys/thread.h
files respectively. - S (-l)
- The state of the process or kernel thread: For processes:
- O
- Nonexistent
- A
- Active
- W
- Swapped
- I
- Idle
- Z
- Canceled
- T
- Stopped
For kernel threads:- O
- Nonexistent
- R
- Running
- S
- Sleeping
- W
- Swapped
- Z
- Canceled
- T
- Stopped
UID (-f,- l)
- The user ID number of the process (the login name is printed under the -f option).
PID (all)
- The process ID of the process.
PPID (-f,-l)
- The process ID of the parent process.
CLS (-c)
- Scheduling classes for the process. Printed only when the -c flag is used.
NI (-l)
- The nice value of the process that is used in calculating priority for the
sched_other
policy. PRI (-c, -l)
- The priority of the process or kernel thread. Higher numbers mean less priority.
ADDR (-l)
- Contains the segment number of the process stack, if normal; if a kernel process, the address of the preprocess data area.
SZ (-l)
- The size in pages of the core image of the process.
WCHAN(-l)
- The event for which the process or kernel thread is waiting or sleeping. For a kernel thread, this field is blank if the kernel thread is running. For a process, the wait channel is defined as the wait channel of the sleeping kernel thread if only one kernel thread is sleeping; otherwise a star is displayed.
STIME (-f,-u)
- The starting time of the process. The
LANG
environment variables control the appearance of this field. TTY (all)
- The controlling terminal for the process:
- -
- The process is not associated with a terminal.
- ?
- Unknown
TIME (all)
- The total runtime for the process. The time is displayed in the format of mm:ss or mmmm:ss if the runtime reaches 100 minutes, which is different from the displayed format if you use the -o time flag.
LTIME (-L)
- The runtime for an individual LWP.
CMD (all)
- Contains the command name. The full command name and its parameters are displayed with the -f flag.
LWP (-L)
- The tid of the kernel thread.
NLWP(-Lf)
- The number of kernel threads in the process.
PSR (-P)
- The logical processor number of the processor to which the kernel thread is bound (if any). For a process, this field is shown if all its threads are bound to the same processor.
RSS (-ly)
- The real memory (resident set) size of the process (in 1 KB units).
- Format
-
The following list describes the field specifiers that are recognized by the system. These field specifiers can be used with the -o flag to specify the format for the output of the ps command.
The field specifiers that are recognized by the the system are:addr
- Indicates the segment number of process stack, if normal; if a kernel process, the address of
the preprocess data area. The default header for this field is
ADDR
. args
- Indicates the full command name being executed. All command-line arguments are included, though
truncation can occur. The default header for this field is
COMMAND
. c
- CPU utilization of a process or thread is incremented each time the system clock ticks and the
process or thread is found to be running. The value is decayed by the scheduler by dividing it by 2
once per second. For the
sched_other
policy, CPU utilization is used in determining process scheduling priority. Large values indicate a CPU intensive process and result in less process priority whereas small values indicate an I/O intensive process and result in a more favorable priority. The default header for this field isC
. class
- Indicates the scheduling policy for a kernel thread. The policies are sched_other, sched_fifo
and sched_rr. The default header for this field is
CLS
. comm
- Indicates the short name of the command being executed. Command-line arguments are not included.
The default header for this field is
COMMAND
. etime
- Indicates the elapsed time since the process started. The elapsed time is displayed in the
format
where dd specifies the number of days, hh specifies the number of hours, mm specifies the number of minutes, and ss specifies the number of seconds.[[ dd -] hh: ]mm :ss
The default header for this field is
ELAPSED
. f
- Indicates flags (hexadecimal and additive) associated with the process. The default header for
this field is
COMMAND
. fname
- Indicates the first 8 bytes of the base name of the process's executable file. The default
header for this field is
COMMAND
. gid
- Indicates the effective group ID number of the process as a decimal integer. The default header
for this field is
GID
. The login name is printed under the -f option. group
- Indicates the effective group ID of the process. The textual group ID is displayed. If the
textual group ID cannot be obtained, a decimal representation is used. The default header for this
field is
GROUP
. lwp
- Indicates the thread ID of the kernel thread. The default header for this field is
TID
. nice
- Indicates the decimal value of the process nice value. The default header for this field is
NI
. nlwp
- Indicates the number of kernel threads that are owned by the process. The default header for
this field is
THCNT
. pcpu
- Indicates the ratio of CPU time that is used to CPU time available, expressed as a percentage.
The default header for this field is
%CPU
. pgid
- Indicates the decimal value of the process group ID. The default header for this field is
PGID
. pid
- Indicates the decimal value of the process ID. The default header for this field is
PID
. pmem
- Indicates the percentage of real memory that is used by this process. The default header for
this field is
%MEM
. ppid
- Indicates the decimal value of the parent process ID. The default header for this field is
PPID
. pri
- Indicates the priority of the process or kernel thread; higher numbers mean less priority. The
default header for this field is
PRI
. psr
- Indicates the logical processor number of the processor to which the kernel thread is bound (if
any). The default header for this field is
PSR
. rgid
- Indicates the real group ID number of the process as a decimal integer. The default header for
this field is
RGID
. rgroup
- Indicates the real group ID of the process. The textual group ID is displayed. If the textual
group ID cannot be obtained, a decimal representation is used. The default header for this field is
RGROUP
. rss
- Indicates the real memory (resident set) size of the process (in 1 KB units). The default header
for this field is
RSS
. ruid
- Indicates the real user ID number of the process as a decimal integer. The default header for
this field is
RUID
. ruser
- Indicates the real user ID of the process. The textual user ID is displayed. If the textual user
ID cannot be obtained, a decimal representation is used. The default header for this field is
RUSER
. s
- Indicates the state of the process. The default header for this field is s.
sid
- Indicates the process ID of the session leader. The default header for this field is
SID
. stime
- Indicates the starting time of the process. The LANG environment variables control the
appearance of this field. The default header for this field is
STIME
. time
- Indicates the cumulative CPU time since the process started. The time is displayed in the same
format as in
etime
. The default header for this field isTIME
. tty
- Indicates the controlling terminal name of the process. The default header for this field is
TT
. uid
- Indicates the effective user ID number of the process as a decimal integer. The default header
for this field is
UID
. user
- Indicates the effective user ID of the process. The textual user ID is displayed. If the textual
user ID cannot be obtained, a decimal representation is used. The default header for this field is
USER
. vsz
- Indicates, as a decimal integer, the size in kilobytes of the core image of the process. The
default header for this field is
VSZ
. wchan
- Indicates the event for which the process or kernel thread is waiting or sleeping. For a kernel
thread, this field is blank if the kernel thread is running. For a process, the wait channel is
defined as the wait channel of the sleeping kernel thread if only one kernel thread is sleeping;
otherwise a star is displayed.
The default header for this field is
WCHAN
.
Flags (System V)
Some flags accept lists as arguments. Items in a list can be either separated by commas or else that is enclosed in double quotation marks and separated by commas or spaces. Values for proclist and pgrplist must be numeric.
Item | Description |
---|---|
-a | Writes to standard output information about all processes, except the session leaders and processes not associated with a terminal. |
-A | Writes to standard output information about all processes. |
-c | Prints information in a format that reflects scheduler properties. The -c flag affects the output of the -f and -l flags, as described in the following. |
-d | Writes to standard output information about all processes, except the session leaders. |
-e | Writes to standard output information about all processes, except kernel processes. |
-f | Generates a full listing. |
-g pgrplist | Writes to standard output information only about processes that are in the process groups that are specified by pgrplist. Values for pgrplist must be numeric. |
-G grplist | Writes to standard output information only about processes that are in the process groups that are specified by grplist. The -G flag accepts group names. |
-j | Displays session ID and process group ID. |
-l | Generates a long listing. |
-L | Prints the status of active threads within a process. |
-o format | Displays information in the format that is specified by format. Multiple field specifiers can be specified for the format variable. The field specifiers that can be used with the -o flag are described above in the Format section. |
-p proclist | Displays information only about processes with the process numbers that are specified by proclist. Values for proclist must be numeric. |
-P | Displays the logical processor number of the processor to which the primary kernel thread of the process is bound (if any). |
-s sidlist | Displays all processes whose session leader's IDs are specified by sidlist. |
-t termlist | Displays information only about processes that are associated with the terminals that are specified by termlist. |
-u uidlist | Displays information only about processes with the user ID numbers or login names that are specified by uidlist. |
-U uidlist | Displays information only about processes with the user ID numbers or login names that are specified by uidlist. |
-X | Prints all available characters of each user and group name instead of truncating to the first 8 characters. |
-y | When combined with the -l option, changes the long listing so that it
prints the RSS and SZ fields in kilobytes and does not print the
F and ADDR ' fields. |
Exit Status (System V)
This command returns the following exit values:
Item | Description |
---|---|
0 | Successful completion. |
>0 | An error occurred. |
Security (System V)
- Attention RBAC users
- Attention RBAC users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations that are associated with this command, see the lssecattr command or the getcmdattr subcommand.
Examples (System V)
- To display all processes, enter:
ps -e -f
- To list processes owned by the user 'guest', enter:
ps -f -l -u guest
- To list processes that are associated with the
/dev/pts/0
and/dev/pts/1
terminals, enter:ps -t pts/0,pts/1
- To list processes not associated with a terminal, enter:
ps -t -
- To display a specified format with field specifiers, enter:
ps -o ruser,pid,ppid,args
- To display information about all kernel threads in a process, enter:
ps -L
- To display the session ID and process group IDs of all the processes, enter:
ps -jA
- To display the scheduling class and priority of processes, enter:
ps -c -l
- To display information about kernel threads and the number of kernel threads in a process,
enter:
ps -L -f
- To display the processor to which the process or kernel thread is bound to, enter:
ps -P
- To print an ASCII art for a given process (
inetd
in the following example), enter:
Output looks like the following:ps -T 14220
PID TTY TIME CMD 14220 - 0:00 inetd 16948 - 0:00 |\--telnetd 32542 pts/4 0:00 | \--ksh 26504 - 0:00 |\--telnetd 41272 pts/5 0:00 | \--ksh 26908 pts/5 0:00 | \--vi 28602 - 0:00 |\--telnetd 24830 pts/0 0:00 | \--ksh 676416 pts/0 0:00 | \--ksh 29984 - 0:00 |\--telnetd 38546 pts/6 0:00 | \--ksh 32126 - 0:00 |\--telnetd 11162 pts/7 0:00 | \--ksh 34466 - 0:00 |\--rpc.ttdbserver 35750 - 0:00 |\--telnetd 23612 pts/3 0:00 | \--ksh 36294 - 0:00 |\--telnetd 38096 pts/8 0:00 | \--ksh 39740 - 0:00 |\--telnetd 42226 pts/9 0:01 | \--ksh 40632 - 0:00 |\--telnetd 40232 pts/2 0:00 | \--ksh 32910 pts/2 0:00 | \--dbx 987990 pts/2 0:00 | \--a.out 40722 - 0:00 |\--telnetd 16792 pts/10 0:00 | \--ksh 37886 pts/10 0:00 | \--ps 105716 - 0:00 \--telnetd 29508 pts/1 0:00 \--ksh 39478 pts/1 0:00 \--ksh 38392 pts/1 0:00 \--vi
- To print information about all processes that are rooted at a given pid, enter:
Output looks like the following:ps -fL 14220
UID PID PPID C STIME TTY TIME CMD root 14220 8676 0 Apr 07 - 0:00 /usr/sbin/inetd root 16948 14220 0 Apr 06 - 0:00 telnetd -a root 23612 35750 0 Apr 10 pts/3 0:00 -ksh root 24830 28602 1 18:30:56 pts/0 0:00 -ksh root 28602 14220 0 18:30:55 - 0:00 telnetd -a root 32542 16948 0 Apr 06 pts/4 0:00 -ksh root 34466 14220 0 Apr 10 - 0:00 rpc.ttdbserver 100083 1 root 35750 14220 0 Apr 10 - 0:00 telnetd -a root 40228 24830 8 18:36:01 pts/0 0:00 ps -fL 14220
- To display all processes with expanded user name, type:
ps -X -e -f
- To display the scheduling policies of a thread, enter the following
command:
#ps -m -o THREAD,sched USER PID PPID TID ST CP PRI SC WCHAN F TT BND COMMAND SCH suresana 1609830 4227284 - A 16 68 1 - 200001 pts/144 - ps -m -o THREAD sched 0 - - - 6381739 R 16 68 1 -400000 - - - 0 suresana 4227284 4239476 - A 1 60 1 -200801 pts/144 - bash 0 - - - 4177981 S 1 60 1 -410400 - - - 0 suresana 4239476 921694 - A 0 60 1 -240001 pts/144 - -ksh 0 - - - 5554385 S 0 60 1 -10400 - - - 0
Files (System V)
Item | Description |
---|---|
/usr/sysv/bin/ps | Contains the System V R4 ps command. |
/etc/passwd | Contains the user ID information. |
/dev/pty* | Indicates terminal (PTY ) names. |
/dev/tty* | Indicates terminal (TTY ) names. |