PS(1)
NAME
ps, cps − report process status
SYNOPSIS
ps [ −edafl ] [ −t termlist ] [ −p proclist ] [ −u uidlist ] [ −g grplist ]
cps [ −edafl ] [ −t termlist ] [ −p proclist ] [ −u uidlist ] [ −g grplist ]
DESCRIPTION
Ps prints certain information about active processes. Without options, information is printed about processes associated with the current terminal. The output consists of a short listing containing only the process ID, terminal identifier, cumulative execution time, and the command name. Otherwise, the information that is displayed is controlled by the selection of options.
In the HP Clustered environment, cps can be used to obtain a cluster wide process listing. A seperate listing is produced for each member of the cluster preceded by the cluster member’s name. Cps only reports on other members of the HP Cluster when the e, d, a, t, p, u or g options have been specified.
Options using lists as arguments can have the list specified in one of two forms: a list of identifiers separated from one another by a comma, or a list of identifiers enclosed in double quotes and separated from one another by a comma and/or one or more spaces.
The options are:
−e Print information about all processes.
−d Print information about all processes, except process group leaders.
−a Print information about all processes, except process group leaders and processes not associated with a terminal.
−f Generate a full listing. (See below for meaning of columns in a full listing.)
−l Generate a long listing. See below.
−m When the -f option is given, print the current argument information from the address space of the process itself, rather than the argument information at the time of exec.
−t termlist Restrict listing to data about the processes associated with the terminals given in termlist. Terminal identifiers may be specified in one of two forms: the device’s file name (e.g., tty04) or if the device’s file name starts with tty, just the digit identifier (e.g., 04).
−p proclist Restrict listing to data about processes whose process ID numbers are given in proclist.
−u uidlist Restrict listing to data about processes whose real user ID numbers or login names are given in uidlist. In the listing, the numerical user ID will be printed unless the −f option is used, in which case the login name will be printed.
−g grplist Restrict listing to data about processes whose process group leaders are given in grplist.
The column headings and the meaning of the columns in a ps listing are given below; the letters f and l indicate the option (full or long) 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:
0 swapped;
1 in core;
2 system process;
4 locked in core (e.g., for physical I/O);
10 being swapped;
20 being traced by another process;
40 another tracing flag;
S (l) The state of the process:
0 non-existent;
S sleeping;
W waiting;
R running;
I intermediate;
Z terminated;
T stopped;
X growing.
UID (f,l) The real user ID number of the process owner; the login name is printed under the −f option.
PID (all) The process ID of the process; it is possible to kill a process if you know this datum.
PPID (f,l) The process ID of the parent process.
C (f,l) Processor utilization for scheduling.
PRI (l) The priority of the process; higher numbers mean lower priority.
NI (l) Nice value; used in priority computation.
ADDR (l) The memory address of the process, if resident; otherwise, the disk address.
SZ (l) The size in blocks of the core image of the process.
WCHAN (l) The event for which the process is waiting or sleeping; if blank, the process is running.
STIME (f) Starting time of the process. The starting date is printed instead if the elapsed time is greater than 24 hours.
TTY (all) The controlling terminal for the process.
TIME (all) The cumulative execution time for the process (reported in the form "min:sec").
COMD (all) The command name; the full command name and its arguments are printed under the −f option. This field is renamed COMMAND except when the −l option is specified.
A process that has exited and has a parent, but has not yet been waited for by the parent, is marked <defunct> (see "zombie process" in exit(2)).
The time printed in the STIME field is the time when the process was forked, not the time when it was modified by exec.
Under the −f option, ps tries to determine the command name and arguments given when the process was created. If the −m option is given, ps makes an educated guess as to the command and arguments currently residing within the address space of the process. It does this by examining memory and the swap area. The method is inherently somewhat unreliable and in any event a process is entitled to destroy this information, so the command line cannot be counted on too much. If the −m option is not given, ps presents the command and arguments given at the time of process creation.
Since process information may be changing as ps retrieves it, and a process performing an exec(2) may pass faulty command name information, the command line data may be inconsistent. If such a situation is detected, the command name as it would appear without the −f option is printed in square brackets. This is the actual pathname of the file read by exec(2) or copied from the parent process by fork(2).
To make ps output safer to display and easier to read, all control characters in the COMD field are mapped to "visible" equivalents. These are of the form ^C, where the original character was in the range 0 - 037 and ^C is that value plus 040.
EXAMPLES
To generate a full listing of all processes currently running on your machine, type:
ps -ef
To check if a certain process exists on the machine for example, cron(1M) (a clock daemon), check the far right column for cron.
FILES
/etc/passwd supplies UID information
/etc/ps_data internal data structure
/dev searched to find terminal (“tty”) names
/dev/mem memory - used with -m option
/dev/kmem virtual memory - used with -m option
/dev/swap the default swap device - used with -m option
SEE ALSO
kill(1), nice(1), acctcom(1M), exec(2), fork(2), exit(2).
WARNINGS
Things can change while ps is running; the picture it gives is only a snapshot in time. Some data printed for defunct processes are irrelevant.
If two special files for terminals are located at the same select code, they are reported in the order in which they appear in /dev, not in alphabetical order.
EXTERNAL INFLUENCES
Environment Variables
LC_TIME determines the format and contents of date and time strings.
If LC_TIME is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, ps behaves as if all internationalization variables are set to "C". See environ(5).
International Code Set Support
Single-byte character code sets are supported.
STANDARDS CONFORMANCE
ps: SVID2, XPG2, XPG3
Hewlett-Packard Company — HP-UX Release 7.0: Sept 1989