Linux and Unix ps command
Quick links
About ps
Syntax
Examples
Related commands
Linux and Unix main page
Reports the process status.
ps [-a] [-A] [-c] [-d] [-e] [-f] [-j] [-l] [-L] [-P] [-y] [ -g grplist ] [ -n namelist ] [-o format ] [ -p proclist ] [ -s sidlist ] [ -t term] [ -u uidlist ] [ -U uidlist ] [ -G gidlist ]
| -a | List information about all processes most frequently requested: all those except process group leaders and processes not associated with a terminal. |
| -A | List information for all processes. Identical to -e, below. |
| -c | Print information in a format that reflects scheduler properties as described in priocntl. The -c option affects the output of the -f and -l options, as described below. |
| -d | List information about all processes except session leaders. |
| -e | List information about every process now running. |
| -f | Generate a full listing. |
| -j | Print session ID and process group ID. |
| -l | Generate a long listing. |
| -L | Print information about each light weight process (lwp) in each selected process. |
| -P | Print the number of the processor to which the process or lwp is bound, if any, under an additional column header, PSR. |
| -y | Under a long listing (-l), omit the obsolete F and ADDR columns and include an RSS column to report the resident set size of the process. Under the -y option, both RSS and SZ will be reported in units of kilobytes instead of pages. |
| -g grplist | List only process data whose group leader's ID number(s) appears in grplist. (A group leader is a process whose process ID number is identical to its process group ID number.) |
| -n namelist | Specify the name of an alternative system namelist file in place of the default. This option is accepted for compatibility, but is ignored. |
| -o format | Print information according to the format specification given in format. This is fully described in DISPLAY FORMATS. Multiple -o options can be specified; the format specification will be interpreted as the space-character-separated concatenation of all the format option-arguments. |
| -p proclist | List only process data whose process ID numbers are given in proclist. |
| -s sidlist | List information on all session leaders whose IDs appear in sidlist. |
| -t term | List only process data associated with term. Terminal identifiers are specified as a device file name, and an identifier. For example, term/a, or pts/0. |
| -u uidlist | List only process data whose effective user ID number or login name is given in uidlist. In the listing, the numerical user ID will be printed unless you give the -f option, which prints the login name. |
| -U uidlist | List information for processes whose real user ID numbers or login names are given in uidlist. The uidlist must be a single argument in the form of a blank- or comma-separated list. |
| -G gidlist | List information for processes whose real group ID numbers are given in gidlist. The gidlist must be a single argument in the form of a blank- or comma-separated list. |
ps
Typing ps alone would list the current running processes. Below is an example of the output that would be generated by the ps command.
PID TTY TIME CMD
6874 pts/9 0:00 ksh
6877 pts/9
0:01 csh
418 pts/9 0:00 csh
ps -ef
Display full information about each of the processes currently running.
UID PID PPID C STIME TTY TIME CMD
hope 29197 18961 0 Sep27 ? 00:00:06 sshd: hope@pts/87
hope 32097 29197 0 Sep27 pts/87 00:00:00
-csh
hope 7209 32097 0 12:17 pts/87 00:00:00 ps -ef
ps -l
Displays processes including those that are in a wait state, similar to the below example.
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 0 T 0 12308 29722 0 80 0 - 16136 finish pts/0 00:00:00 pico 0 R 0 12530 29722 0 80 0 - 15884 - pts/0 00:00:00 ps 4 S 0 29722 29581 0 80 0 - 16525 wait pts/0 00:00:00 bash