ps - Displays current process status
ps [-aAdejflm] [-o specifier][=header],... [-O specifier][=header],... [-g glist] [-G glist] [-p plist] [-s slist] [-t tlist] [-u ulist] [-U ulist] [-n nlist]
ps [aAeghjlLmsSTuvwx] [o specifier][=header],... [O specifier][=header],... [t tty] [process_number]
command displays the current process status.
Interfaces documented on this reference page conform to industry standards as follows:
ps: XPG4, XPG4-UNIX
Refer to the
reference page for more information
about industry standards and associated tags.
The following options can be used with ps: Prints information to standard output about all processes, except the session leaders and processes not associated with a terminal. Writes information for all processes. Prints information to standard output about all processes, except the session leaders. Prints information to standard output about all processes. Equivalent to -A. Generates a full listing. Prints only information about processes that are in the process groups listed in glist. The glist is a list of process-group identifiers enclosed in " " (double quotes) and separated from one another by a comma or one or more spaces (or tabs), or both. Because of the way the shell treats spaces and tabs, you need to quote space-separated lists. Writes information for processes whose real group ID numbers or names are given in glist. The glist is a list of process-group identifiers enclosed in " " (double quotes) and separated from one another by a comma or one or more spaces (or tabs), or both. Because of the way the shell treats spaces and tabs, you need to quote space-separated lists. [Compaq] Produces job control information, with fields specified for user, pid, ppid, pgid, sess, jobc, state, tname, time and command. Generates a long listing. [Compaq] Prints all threads in a task, if the task has more than one. Specifies a list of format specifiers to describe the output format.
[Compaq] The following BSD compatible options can be used with
(note that these options are not prefixed with a
[Compaq] Asks for information regarding processes associated
with terminals (ordinarily only one's own processes are displayed).
[Compaq] Increases the argument space.
[Compaq] Asks for the environment to be printed, as well
as the arguments to the command.
[Compaq] Asks for all processes. Without this option,
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.
[Compaq] Repeats the header after each screenful of information.
[Compaq] Produces job control information, with fields specified
[Compaq] Asks for a detailed list, with fields specified
[Compaq] Lists all available format specifiers.
[Compaq] Prints all threads in a task, if the task has more
[Compaq] Specifies a list of format specifiers to describe
the output format.
[Compaq] Same as
it displays the fields specified by
in addition to the specifiers supplied on the command line.
[Compaq] Gives signal states of the processes, with fields
[Compaq] Prints usage summaries (total usage of a command,
as opposed to current usage).
[Compaq] Lists only processes for the specified terminal.
[Compaq] Lists all processes on your terminal.
[Compaq] Produces a user oriented output. This includes fields
[Compaq] Produces a version of the output containing virtual
memory statistics. This includes fields specified by
[Compaq] Uses a wide output format (132 columns (bytes) rather
than 80); if this option is doubled (ww), uses an arbitrarily
wide output. This information determines how much of long commands to print.
[Compaq] Asks even about processes with no terminal.
[Compaq] Restricts output to the specified process. This
argument must be entered last on the command line.
While ps is a fairly accurate snapshot of the system, ps cannot begin and finish a snapshot as fast as some processes change state. At times there may be minor discrepancies.
The ps command can be used on multiprocessing systems and for querying the system state of realtime applications for their POSIX priority and scheduling policy.
Output formats for each process include the process ID (pid), control terminal of the process (tname), CPU time used by the process (cputime) (this includes both user and system time), the state of the process (state), and an indication of the command that is running (command). The abbreviation tty indicates a terminal.
[Compaq] The state is given by a sequence of letters, for example, RWN. The first letter indicates the status of the process: [Compaq] Runnable process. [Compaq] Uninterruptible sleeping process. [Compaq] Process sleeping for less than about 20 seconds. [Compaq] Idle (sleeping longer than about 20 seconds) process. [Compaq] Stopped process. [Compaq] Halted process.
[Compaq] Additional characters after these, if any, indicate additional state information: [Compaq] Process is swapped out (shows a blank space if the process is loaded (in-core)). [Compaq] Process has specified a soft limit on memory requirements and is exceeding that limit; such a process is (necessarily) not swapped.
[Compaq] An additional letter may indicate whether a process is running
with altered CPU scheduling priority (nice):
[Compaq] Process priority is reduced.
[Compaq] Process priority has been artificially raised.
[Compaq] Process is a process group leader with a controlling
The following list contains all format specifiers that can be used with ps:
[Compaq] Process accounting flag
|c||C||CPU utilization factor for scheduling|
[Compaq] Command arguments
|comm||COMMAND||Command name for accounting|
[Compaq] Command arguments (and environment
[Compaq] Short-term CPU utilization factor
(used in scheduling)
[Compaq] Current CPU time used
|cursig||CURSIG||[Compaq] Current signal|
|etime||ELAPSED||Time command has been running|
|flag||F||[Compaq] Process flags|
[Compaq] Block input operations
[Compaq] Current count of processes qualifying
PGID for job control
[Compaq] User's login name
[Compaq] Long controlling terminal device
[Compaq] Start date and time of process
|majflt||MAJFLT||[Compaq] Page faults|
|minflt||MINFLT||[Compaq] Page reclaims|
[Compaq] Messages received
|msgsnd||MSGSND||[Compaq] Messages sent|
Process scheduling increment (see the
[Compaq] Involuntary context switches
[Compaq] Signals received
[Compaq] Voluntary context switches
[Compaq] Address of event on which a process
is waiting (an address in the system). In this case, the initial part of
the address is trimmed off and is printed hexadecimally, for example,
[Compaq] Block output operations
[Compaq] Number of disk I/Os resulting from
references by the process to pages not loaded in core.
Percent CPU usage. This is a decaying average
of 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
fields to exceed 100%.
|pgid||PGID||Process group ID|
[Compaq] Percent real memory usage
[Compaq] Current scheduling policy
|ppid||PPID||Parent process ID|
[Compaq] Process priority
[Compaq] Current processor set (^
[Compaq] Current processor (~
[Compaq] POSIX scheduling priority
[Compaq] Process group (real GID)
|rgroup||RGROUP||Real group name|
[Compaq] Real memory (resident set) size
of the process (in 1024 byte units)
[Compaq] Process user ID (real UID)
|scount||SCNT||[Compaq] Suspend count|
|sess||SESS||[Compaq] Session ID|
[Compaq] Signals pending to this process
[Compaq] Signals being caught
[Compaq] Signals being ignored
[Compaq] Current signal mask
|sl||SL||[Compaq] Sleep time|
[Compaq] Start time of process. If start
time was more than 24 hours ago, gives the date.
[Compaq] Symbolic process status
|status||STATUS||[Compaq] Process status|
Start time of process. If start time was
more than 24 hours ago, gives the date.
[Compaq] Saved process group ID
[Compaq] Saved process user ID
[Compaq] Time spent in system
[Compaq] Major/minor device for controlling
|time||TIME||Current CPU time used|
[Compaq] Controlling terminal device name
[Compaq] Foreground process group associated
[Compaq] Session associated with terminal
|tt||TTY||Controlling terminal device name|
|tty||TTY||Controlling terminal device name|
[Compaq] Command name for accounting
[Compaq] Process user ID (effective UID)
|umask||UMASK||[Compaq] Process umask|
[Compaq] Time spent in user space
[Compaq] Base scheduling priority
[Compaq] Address of process in user area
[Compaq] Process virtual address size
|vsz||VSZ||Process virtual address size|
[Compaq] Address of event on which a process
is waiting (an address in the system). A symbol is chosen that classifies
the address, if available, from the system; otherwise, it is printed numerically.
[Compaq] Compound format specifiers are made up of groups of individual format specifiers, as follows:
[Compaq] minflt, majflt, nswap,
inblock, oublock, msgsnd, msgrcv, nsigs, nvcsw, nivcsw
[Compaq] user, pcpu, pri, scnt,
wchan, usertime, systime
|DFMT (default printing format)||
[Compaq] pid, tname, state, cputime,
|LFMT (BSD l format)||
[Compaq] uid, pid, ppid, cp, pri,
nice, vsz, rss, wchan, state, tname, cputime, command
|JFMT (j format)||
[Compaq] user, pid, ppid, pgid,
sess, jobc, state, tname, cputime, command
|SFMT (BSD s format)||
[Compaq] uid, pid, cursig, sig,
sigmask, sigignore, sigcatch, stat, tname, command
|VFMT (BSD v format)||
[Compaq] pid, tt, state, time,
sl, pagein, vsz, rss, pcpu, pmem, command
|UFMT (BSD u format)||
[Compaq] uname, pid, pcpu, pmem,
vsz, rss, tt, state, start, time, command
|F5FMT (f format)||
[Compaq] uname, pid, ppid, pcpu,
start, tt, time, command
|L5FMT (l format)||
[Compaq] f, state, uid, pid, ppid,
pcpu, pri, nice, rss, wchan, tt, time, ucomm
|FL5FMT (lf format)||
[Compaq] f, state, uid, pid, ppid,
pcpu, pri, nice, rss, wchan, start, time, command
[Compaq] user, pcpu, pri, usrpri,
nice, psxpri, psr, policy, pset
The flags associated with process in <sys/proc.h> are as follows:
|Symbolic Constant||Flag Value||Meaning|
[Compaq] Swapper or pager process
|SLOMAP||0x00000004||Process allowed to use low virtual memory|
|SNOTASK||0x00000040||Process completed exit|
|SWWAIT||0x00000080||Thread is removing zombie|
|SOMASK||0x00000200||Restore old mask after taking signal|
|SWEXIT||0x00000400||Working on exiting|
|SPHYSIO||0x00000800||Doing physical I/O|
Process resulted from
|SPAGV||0x00008000||Init data space on demand, from vnode|
|SSEQL||0x00010000||User warned of sequential vm behavior|
|SUANOM||0x00020000||User warned of random vm behavior|
|SCONTIGN||0x00040000||Process is ignoring SIGCONT|
Process is using Single UNIX(R) Specification
Process marked as a login for Capacity Limitation
|SCTTY||0x00800000||Process has a controlling terminal|
|SXONLY||0x02000000||Process image read-protected|
|SAIO||0x08000000||Process performed asynchronous I/O|
|SNOCLDWAIT||0x20000000||No zombies when children exist|
|SEXEC||0x80000000||Process called exec|
A process that has exited but whose parent process has not
waited for it.
[Compaq] A process for which user area information could
not be obtained due to a shortage of system memory.
A process that is blocked trying to exit.
[Compaq] The following BSD compatible options are not supported.
(You can reconstruct the output of these options by using the appropriate
format specifiers, however.)
[Compaq] Displays 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.
[Compaq] Displays numeric output. In a long listing, the
field is printed numerically rather than symbolically. In
a user listing, the
field is replaced by a
The arguments displayed by
format specifiers reflect the arguments passed to the command
at its invocation. Any modification made to the arguments by the running
command are not available.
The arguments displayed by
format specifiers are the only output fields that contain
embedded blanks, which may be a concern if the output is passed to some type
of parser. Since output fields appear in the order of the format specifiers
on the command line, you should put these specifiers at the end of the command
if you are using a parser to analyze the output.
[Compaq] When you enter a ps command while running an application that forks child processes, you might see some child processes listed as being in the <defunct> state after they have exited. Processes in this state cannot be killed until the process that forked them is killed.
The following exit values are returned:
An error occurred.
To list all your processes, enter: ps To list all processes, enter: ps -A
PID USER %CPU PRI UPR NI PPR PSR POL PSET S TTY TIME COM 458 root 0.0 43 44 0 20 0 TS 0 I + console 0:01.34 csh 561 root 0.0 44 44 0 19 0 TS 0 I ttyp0 0:00.42 csh 567 root 0.0 44 44 0 19 1 TS ^2 I ttyp0 0:00.03 runon 568 root 0.0 44 44 0 19 1 TS ^2 I ttyp0 0:00.03 sh 569 root 0.0 44 44 0 19 1 TS ^2 S ttyp0 0:00.31 csh 579 root 0.0 44 44 0 19 ~1 TS ^2 S + ttyp0 0:00.03 runon 580 root 0.0 44 44 0 19 ~1 TS ^2 S + ttyp0 0:00.03 sh 581 root 0.0 44 44 0 19 ~1 TS ^2 R + ttyp0 0:00.06 ls -l
The following environment variables affect the execution of
Overrides the horizontal screen size, used to determine the
number of text columns to display.
Provides a default value for the internationalization variables
that are unset or null. If
is unset or null, the corresponding value from the default locale is used.
If any of the internationalization variables contain an invalid setting, the
utility behaves as if none of the variables had been defined.
If set to a non-empty string value, overrides the values of
all the other internationalization variables.
Determines the locale for the interpretation of sequences
of bytes of text data as characters (for example, single-byte as opposed to
multibyte characters in arguments).
Determines the locale for the format and contents of diagnostic
messages written to standard error.
Determines the format and contents of the date and time strings
Determines the location of message catalogues for the processing
Searched to find terminal names.
Commands: kill(1), nice(1), renice(8), runon(1), w(1)
Functions: exit(2), fork(2), getpriority(2), exec(2), wait(2)
Routines: nlist(3), sched_setscheduler(3)