DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

ps(C)


ps -- report process status

Synopsis

ps [options]

Description

The ps command prints information about active processes and lightweight processes, or LWPs. Without options, ps prints information about processes associated with the controlling terminal. The output contains only the process ID, terminal identifier, cumulative execution time, and the command name. Otherwise, the information that is displayed is controlled by the options.

Some options accept lists as arguments. Items in a list can be either separated by commas or else enclosed in double quotes and separated 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 session leaders and processes not associated with a terminal.

-A
Print information about all processes.

-c
Print information in a format that reflects scheduler properties as described in priocntl(C). The -c option affects the output of the -f and -l options, as described below.

-C
Print the CPU-Group ID for each process. If a process is bound to a specific CPU-Group (see cg_bind(S)), it prints b along with the CPU-Group ID.

-d
Print information about all processes except session leaders.

-e
Print information about every process now running.

-f
Generate a full listing. (See below for significance of columns in a full listing.)

-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.

-G grplist
List process data whose real group ID number(s) appears in grplist.

-j
Print session ID and process group ID.

-l
Generate a long listing. (See below.)

-L
Print status of active LWPs within a process.

-o format
List information according to the format specified in format. Multiple -o options can be specified. See ``Specifying output format''.

-p proclist
List only process data whose process ID numbers are given in proclist.

-P
Print the processor number on which an LWP is running when the LWP has been explicitly bound by a user.

-r sysnam
Change the root directory to that specified by sysnam which can be an absolute pathname or a system name. If a system name is given, ps will use the first filesystem entry in /etc/mnttab whose last component matches sysnam. A proc directory must exist at the path implied by sysnam.

-s sidlist
List information on all session leaders whose IDs appear in sidlist.

-t termlist
List only process data associated with the terminal given in termlist. Terminal identifiers may be specified in one of two forms: the device's file name (for example, term/04) or, if the device's file name starts with term, just the digit identifier (for example, 04). -f option, which prints the login name.

-u uidlist
List only process data whose 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 process data only for processes whose real user ID or login names are in uidlist.

-y
Must be combined with -l option. Changes the long listing: prints the ``RSS'' field in kilobytes and does not print the ``F'' and ``ADDR'' fields.

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.

Output

The column headings and the meaning of the columns in a ps listing are given below; the letters f and l identify the option (full or long, respectively) that causes the corresponding heading to appear; all means that the heading always appears.

Note that these two options determine only what information is provided for a process; they do not determine which processes will be listed.


F(l)
Flags (octal and additive) associated with the process, or the LWP if the -L option is specified.


00
Process has terminated: process table entry now available.

01
A system process: always in primary memory.

02
Parent is tracing process.

04
Tracing parent's signal has stopped process: parent is waiting; (see ptrace(S)).

10
Process is currently in primary memory.

20
Process currently in primary memory: locked until an event completes.

40
Process cannot be swapped.

S(l)
The state of the process, or the LWP if the -L option is specified:


O
Process is running on a processor.

S
Sleeping: process is waiting for an event to complete.

R
Runnable: process is on run queue.

I
Idle: process is being created.

Z
Zombie state: process terminated and parent not waiting.

T
Traced: process stopped by a signal because parent is tracing it.

UID(f,l)
The user ID number of the process owner of the LWP (the login name is printed under the -f option).

PID(all)
The process ID of the LWP (This information is necessary to kill a process). When a process is multithreaded, a PID appears for each active process.

PPID(f,l)
The process ID of the parent process.

CG
The CPU-group ID for each process.

CLS(f,l)
Scheduling class for the process, or the LWP when the -L option is specified. Printed only when the -c option is used.

NI(l)
The nice value of the process.

PRI(l)
The priority of the process, or the LWP when the -L option is specified. A higher number means a higher process priority.

ADDR (l)
The memory address of the process.

SZ (l)
The size (in kilobytes) of the virtual address space of the process.

WCHAN (l)
The address of an event for which the process is sleeping; if blank, the process is running. For an individual LWP if -L is specified.

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 days.)

LTIME
The execution time for an individual LWP.

TT (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.

CMD (all)
The command name (the full command name and its arguments are printed under the -f option).

NLWP
The number of LWPs in the process.

PSR
The processor id of the processor on which the LWP is running when the user has explicitly bound the LWP to a particular processor. When a ``-'' is listed, the LWP has not been explicitly bound, but is executing on a scheduler-assigned processor.

RSS
Stable resident set size in kilobytes.

A process that has exited and has a parent, but has not yet been waited for by the parent, is marked <defunct>.

Specifying output format

The following table shows the format keywords you can specify with the -o format option. Multiple -o options can be specified.

ruser The real user ID of the process. This will be the textual user ID, if it can be obtained and the field width permits, or a decimal representation otherwise. RUSER
user The effective user ID of the process. This will be the textual user ID, if it can be obtained and the field width permits, or a decimal representation otherwise. USER
rgroup The real group ID of the process. This will be the textual group ID, if it can be obtained and the field width permits, or a decimal representation otherwise. RGROUP
group The effective group ID of the process. This will be the textual group ID, if it can be obtained and the field width permits, or a decimal representation otherwise. GROUP
cg The CPU-Group for the process. CG
pid The decimal value of the process ID. PID
ppid The decimal value of the parent process ID. PPID
pgid The decimal value of the process group ID. PGID
pcpu The ratio of CPU time used recently to CPU time available in the same period, expressed as a percentage. The meaning of ``recently'' in this context is unspecified. The CPU time available is determined in an unspecified manner. %CPU
vsz The size of the process in (virtual) memory in kilobytes as a decimal integer. VSZ
nice The decimal value of the system scheduling priority of the process. See nice(C). NI
etime The elapsed time since the process was started, in the form [[dd-]hh:]mm:ss where dd will represent the number of days, hh the number of hours, mm the number of minutes, and ss the number of seconds. The dd field will be a decimal integer. The hh, mm, and ss fields will be two-digit decimal integers padded on the left with zeros. ELAPSED
time The cumulative CPU time of the process in the form: [[dd-]hh:]mm:ss as described above for etime. TIME
tty The name of the controlling terminal of the process (if any) in the same format used by the who(C) utility. TT
comm The name of the command being executed (argv [0] value) as a string. COMMAND
args The command with all its arguments as a string. COMMAND

 ruser    The real user ID of   RUSER
          the process. This
          will be the textual
          user ID, if it can
          be obtained and the
          field width
          permits, or a
          decimal
          representation
          otherwise.
 user     The effective user    USER
          ID of the process.
          This will be the
          textual user ID, if
          it can be obtained
          and the field width
          permits, or a
          decimal
          representation
          otherwise.
 rgroup   The real group ID     RGROUP
          of the process.
          This will be the
          textual group ID,
          if it can be
          obtained and the
          field width
          permits, or a
          decimal
          representation
          otherwise.
 group    The effective group   GROUP
          ID of the process.
          This will be the
          textual group ID,
          if it can be
          obtained and the
          field width
          permits, or a
          decimal
          representation
          otherwise.
 cg       The CPU-Group for     CG
          the process.
 pid      The decimal value     PID
          of the process ID.
 ppid     The decimal value     PPID
          of the parent
          process ID.
 pgid     The decimal value     PGID
          of the process
          group ID.
 pcpu     The ratio of CPU      %CPU
          time used recently
          to CPU time
          available in the
          same period,
          expressed as a
          percentage.  The
          meaning of
          ``recently'' in
          this context is
          unspecified.  The
          CPU time available
          is determined in an
          unspecified manner.
 vsz      The size of the       VSZ
          process in
          (virtual) memory in
          kilobytes as a
          decimal integer.
 nice     The decimal value     NI
          of the system
          scheduling priority
          of the process.
          See nice(C)
 etime    The elapsed time      ELAPSED
          since the process
          was started, in the
          form
          [[dd-]hh:]mm:ss
          where dd will
          represent the
          number of days, hh
          the number of
          hours, mm the
          number of minutes,
          and ss the number
          of seconds.  The dd
          field will be a
          decimal integer.
          The hh, mm, and ss
          fields will be two-
          digit decimal
          integers padded on
          the left with
          zeros.
 time     The cumulative CPU    TIME
          time of the process
          in the form:
          [[dd-]hh:]mm:ss as
          described above for
          etime.
 tty      The name of the       TT
          controlling
          terminal of the
          process (if any) in
          the same format
          used by the who(C)
          utility.
 comm     The name of the       COMMAND
          command being
          executed (argv [0]
          value) as a string.
 args     The command with      COMMAND
          all its arguments
          as a string.

In addition to the above formats, the following formats are also accepted, for compatibility with previous versions of OpenServer:

   
uid Real user ID of the process as a decimal value. UID
pri Priority value of the process. PRI
sess Process session leader ID as a decimal value. SESSION
size Size of the swappable image of the process (data and stack) in kilobytes. SZ
addr Virtual address of the process' entry in the process table. ADDR
class Scheduler class of the process. CLASS
stime Time when the process started. STIME
wchan Address of an event for which a process is sleeping. WCHAN
s see ``Output'', above. S
c see ``Output'', above. C
f see ``Output'', above. F

 uid     Real user ID of the      UID
         process as a decimal
         value.
 pri     Priority value of the    PRI
         process.
 sess    Process session leader   SESSION
         ID as a decimal value.
 size    Size of the swappable    SZ
         image of the process
         (data and stack) in
         kilobytes.
 addr    Virtual address of the   ADDR
         process' entry in the
         process table.
 class   Scheduler class of the   CLASS
         process.
 stime   Time when the process    STIME
         started.
 wchan   Address of an event      WCHAN
         for which a process is
         sleeping.
 s       see ``Output'', above.   S
 c       see ``Output'', above.   C
 f       see ``Output'', above.   F

Compatibility Notes

There is a subtle difference in the way tty names can be abbreviated for -t. In previous releases, ps -t p0 would match /dev/ttyp0, whereas it currently would only match /dev/p0. However, ps -t 01 continues to match /dev/tty01, as in previous releases.

Some output fields have more space allocated to them than in previous releases, but the field order and other field widths are the same as in previous releases.

The default header for -o tty is TT and is left-justified; in previous releases it was TTY and was right-justified.

The heading CMD was printed COMD in previous releases.

The C heading appears for compatibility with previous releases, but it refers to a field that is obsolete and always prints as zero.

The process size (SZ) is always printed in Kbytes; it was printed in pages in previous releases.

The PRI field always uses higher numbers to indicate higher process priorities. In previous releases, this depended on the setting of -c.

Files


/proc/*
process information

/etc/passwd
UID information supplier

/etc/ps_data
internal data structure

/usr/lib/locale/locale/LC_MESSAGES/uxcore
language-specific message file (See LANG on environ(F).)

References

getty(C), kill(C), nice(C), priocntl(C).

Notices

Things can change while ps is running; the snap-shot it gives is true only for a split-second, 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 sequence, looking for the controlling terminal and attempts to report on processes associated with the controlling terminal. In this case, if stdin, stdout, and stderr are all redirected, ps will not find a controlling terminal, so there will be no report.

ps -ef may not report the start of a tty login session, but rather an earlier time, when a getty was last respawned on the tty line.

The -y option has no effect unless combined with the -l option. It is identical to the -x option in System V Release 4 MP.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005