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. If not options are specified, 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 separate 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.
Options
ps and cps recognize the following options:
-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.
-t termlist Restrict listing to data about the processes associated with the terminals given in termlist. Terminal identifiers can be specified in one of two forms: the device’s file name (such as tty04) or if the device’s file name starts with tty, just the digit identifier (such as 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 is printed unless the -f option is used, in which case the login name is 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 traced by another process;
20 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().
ps prints the command name (and arguments, if the -f option is specified) given at the time of process creation.
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 through 037 and ^C is that value plus 040.
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.
EXAMPLES
Generate a full listing of all processes currently running on your machine:
ps -ef
To check if a certain process exists on the machine such as cron (a clock daemon) for example, 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
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 is 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.
The -m option, which was available in release 7.0, is no longer available. This option caused ps to print the command name and arguments that resided within the address space of the process.
The flags field printed out with the -l option no longer contains a flag indicating that a process is currently being swapped out. A process is now considered swapped out as soon as the swapping operation begins.
STANDARDS CONFORMANCE
ps: SVID2, XPG2, XPG3
Hewlett-Packard Company — HP-UX Release 9.0: August 1992