ps - process status
ps [-aAdefFhjHlnwx] [-g sids] [-G grouplist]
[-o "format[=head][,format[=head]]..."]
[-p proclist] [-S sessionlist] [-t ttylist]
[-u userlist] [-U userlist] [-X{unix|win}]
The ps(1) utility displays a header line followed by lines containing information about your processes that have controlling terminals. (The information is read from the /proc file system.)
The information displayed is selected based on a set of keywords (see the -L -O and -o options). The default output format includes, for each process, the controlling terminal for the process, CPU time (including both user and system time), state, and associated command.
The options are as follows:
Output comes in three formats: default, full, and long. The options -f, -j, -l, and -o change the default format. The section Format later in this topic describes all of the possible output fields. Very long lines of output are truncated to 80 characters, unless either -w or -ww options is given.
For each process, the default output format displays the following:
$ ps -a
PID TTY TIME CMD
8515 n00 0:00.06 ksh
8579 n00 0:00.01 ps
8 S00 0:30.40 SystemProcess
200 S00 0:00.64 csrss.exe
224 S00 0:11.20 winlogon.exe
252 S00 0:12.26 services.exe
264 S00 1:13.64 lsass.exe
...
For each process, the full output format displays the following:
$ ps -af
UID PID PPID STIME TTY TIME CMD
kim 8259 8515 12:43:31 n00 0:00.01 ps -af
kim 8515 8131 12:41:06 n00 0:00.07 ksh
+SYSTEM 8 0 Jul 27 S00 0:30.43 SystemProcess
+SYSTEM 200 172 Jul 27 S00 0:00.64 F:\WINNT\system32\csrss.exe F:\W
+SYSTEM 224 172 Jul 27 S00 0:11.22 F:\WINNT\system32\winlogon.exe w
+SYSTEM 252 224 Jul 27 S00 0:12.27 F:\WINNT\system32\services.exe F
+SYSTEM 264 224 Jul 27 S00 1:13.68 F:\WINNT\system32\lsass.exe F:\W
...
For each process, the long output format displays the following:
$ ps -al
STATE UID PID PPID NI SZ WCHAN TTY TIME CMD
Seg kim 8515 8131 2 584 4a7aa3a5 n00 0:00.07 ksh
Seg kim 8643 8515 2 424 0 n00 0:00.02 ps
R +SYSTEM 8 0 2 216 0 S00 0:30.44 SystemProcess
R +SYSTEM 200 172 -3 1388 0 S00 0:00.64 csrss.exe
R +SYSTEM 224 172 -3 11440 0 S00 0:11.22 winlogon.exe
R +SYSTEM 252 224 1 5328 0 S00 0:12.27 services.exe
R +SYSTEM 264 224 -3 11596 0 S00 1:13.75 lsass.exe
...
The -l option provides a state field, which consists of a one-letter run state followed by one or more flag letters.
The run state is one of the following:
The flag letters can be:
You can use the -o option to specify the format of the output; the format string consists of field names and optional column titles for those fields.
The following list provides the field names, with their default titles:
Field | Title | Meaning |
---|---|---|
addr | ADDR | address (not implemented) |
args | COMMAND | command and argument list |
c | C | cpu use for scheduling (not implemented) |
comm | COMMAND | argv[0] (the command name) |
etime | ELAPSED | elapsed time |
flags | F | process flags (octal) |
group | GROUP | effective group ID |
nice | NI | scheduling priority |
ofdc | FDCOUNT | number of open file descriptors |
pcpu | %CPU | cpu time used/available |
pgid | PGID | process group ID |
pid | PID | process ID |
ppid | PPID | parent process ID |
pri | PRI | priority (not implemented) |
rgroup | RGROUP | real group ID |
ruser | RUSER | real user ID |
s | S | process state |
sid | SID | session ID |
state | STATE | process state & flags |
stime | STIME | process starting time |
sz | SZ | working set size, in K |
time | TIME | cpu time |
tty | TT | controlling terminal |
user | USER | effective user ID |
vsz | VSZ | virtual memory size, in K |
wchan | WCHAN | even on which process is blocked |
If you specify a field that is not implemented, ps(1) displays a hyphen (-).
Since there is no way for a process to change its effective user or group ID, the user and group fields are always identical to the ruser and rgroup fields, respectively.
Note that if your full user name (such as ACCTG+rrichards) is smaller than the width of the USER field, the user name will be printed, and if it is longer, the numeric user ID is printed. The default width is ten characters. To force the user name to be displayed, make sure that the field width for USER is large enough. For example:
ps -ef -o "user=ReallyWideUidHeaderField,pid,ppid,tty,time,comm"
The ps(1) utility returns 0 for success and greater than 0 if an error occurred.
Because ps(1) cannot run faster than the system, and is run as any other scheduled process, the information it displays can never be exact.
The ps(1) command does not display the full command line for other users' processes. This is a security feature: command lines can contain sensitive information, such as a password.
kill(1)
exec(2)
setuid(2)
strftime(3)
proc(4)