Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > P

ps(1)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

ps — report process status

SYNOPSIS

ps [-adeflPzx] [-g grplist] [-p proclist] [-R prmgrplist] [-t termlist] [-u uidlist] [-Z pset_list]

UNIX Standard Synopsis

ps [-aAcdefHjlPzx] [-C cmdlist] [-g grplist] [-G gidlist] [-n namelist] [-o format] [-p proclist] [-R prmgrplist] [-s sidlist] [-t termlist] [-u uidlist] [-U uidlist] [-Z pset_list]

DESCRIPTION

ps prints information about selected processes. Use options to specify which processes to select and what information to print about them.

Process Selection Options

Use the following options to choose which processes should be selected.

Note: If an option is used in both the default (standard HP-UX) and UNIX Standard (see standards(5)) environments, the description provided here documents the default behavior. Refer to the Notes section for additional information on UNIX Standard behavior.

(none)

Select those processes associated with the current terminal.

-A

(UNIX Standard Only, see standards(5)) Select all processes. (Synonym for -e.)

-a

Select all processes except process group leaders and processes not associated with a terminal.

-C cmdlist

(UNIX Standard Only, see standards(5)) Select processes executing a command with a basename given in cmdlist.

-d

Select all processes except process group leaders.

-e

Select all processes.

-g grplist

Select processes whose process group leaders are given in grplist.

-G gidlist

(UNIX Standard Only, see standards(5)) Select processes whose effective group ID numbers or group names are given in gidlist.

-n namelist

(UNIX Standard Only, see standards(5)) This option is ignored; its presence is allowed for standards compliance.

-p proclist

Select processes whose process ID numbers are given in proclist.

-R prmgrplist

Select processes belonging to PRM process resource groups whose names or ID numbers are given in prmgrplist. See DEPENDENCIES.

-s sidlist

(UNIX Standard Only, see standards(5)) Select processes whose session leaders are given in sidlist. (Synonym for -g).

-t termlist

Select 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 rest of it (such as 04). If the device's file is in a directory other than /dev or /dev/pty, the terminal identifier must include the name of the directory under /dev that contains the device file (such as pts/5).

-u uidlist

Select processes whose real user ID numbers or login names are given in uidlist.

-U uidlist

(UNIX Standard Only, see standards(5)) Select processes whose real user ID numbers or login names are given in uidlist.

-Z pset_list

Select processes whose processor set ID's are given in pset_list. This option is supported only if the kernel supports processor sets functionality.

If any of the -a, -A, -d, or -e options is specified, the -C, -g, -G, -p, -R, -t, -u, -Z, and -U options are ignored.

If more than one of -a, -A, -d, and -e are specified, the least restrictive option takes effect.

If more than one of the -C, -g, -G, -p, -R, -t, -u, -Z, and -U options are specified, processes will be selected if they match any of the options specified.

The lists used as arguments to the -C, -g, -G, -p, -R, -t, -u, -Z, and -U options can be specified in one of two forms:

  • A list of identifiers separated from one another by a comma.

  • A list of identifiers enclosed in quotation marks (" ) and separated from one another by a comma and/or one or more spaces.

Output Format Options

Use the following options to control which columns of data are included in the output listing. The options are cumulative.

(none)

The default columns are: pid, tty, time, and comm, in that order.

-f

Show columns user, pid, ppid, cpu, stime, tty, time, and args, in that order.

-l

Show columns flags, state, uid, pid, ppid, cpu, intpri, nice, addr, sz, wchan, tty, time, and comm, in that order.

-fl

Show columns flags, state, user, pid, ppid, cpu, intpri, nice, addr, sz, wchan, stime, tty, time, and args, in that order.

-c

(UNIX Standard Only, see standards(5)) Remove columns cpu and nice; replace column intpri with columns cls and pri.

-j

(UNIX Standard Only, see standards(5)) Add columns pgid and sid after column ppid (or pid, if ppid is not being displayed).

-z

Add column pset before column prmgrp / prmid. If prmgrp and prmid are not present, add column pset before column pid. (Note that ps displays the kernel processor set id, where all kernel daemons run, as KERN).

The -z option is supported only if the kernel supports processor sets functionality.

-P

Add column prmid (for -l) or prmgrp (for -f or -fl) immediately before column pid. See the DEPENDENCIES section.

-o format

(UNIX Standard Only, see standards(5)) format is a comma- or space-separated list of the columns to display, in the order they should be displayed. (Valid column names are listed below.) A column name can optionally be followed by an equals sign (=) and a string to use as the heading for that column. (Any commas or spaces after the equals sign become part of the column heading. If more columns are desired, they must be specified with additional -o options.) The width of the column will be the greater of the width of the data to be displayed and the width of the column heading. If an empty column heading is specified for every heading, no heading line will be printed. This option overrides options -c, -f, -j, -l, -z, and -P; if they are specified, they are ignored.

-H

(UNIX Standard Only.) Shows the process hierarchy. Each process is displayed under its parent, and the contents of the args or comm column for that process is indented from that of its parent. Note that this option is expensive in both memory and speed.

-x

Shows the command line in extended format.

The column names and their meanings are given below. Except where noted, the default heading for each column is the uppercase form of the column name.

addr

The memory address of the process, if resident; otherwise, the disk address.

args

The command line given when the process was created. This column should be the last one specified, if it is desired. Only a subset of the command line is saved by the kernel; as much of the command line will be displayed as is available. The output in this column may contain spaces. The default heading for this column is COMMAND if -o is specified and CMD otherwise.

cls

Process scheduling class, see rtsched(1).

comm

The command name. The output in this column may contain spaces. The default heading for this column is COMMAND if -o is specified and CMD otherwise.

cpu

Processor utilization for scheduling. The default heading for this column is C.

etime

Elapsed time of the process. The default heading for this column is ELAPSED.

flags

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

The default heading for this column is F.

intpri

The priority of the process as it is stored internally by the kernel. This column is provided for backward compatibility and its use is not encouraged.

gid

The group ID number of the effective process owner.

group

The group name of the effective process owner.

nice

Nice value; used in priority computation (see nice(1)). The default heading for this column is NI.

pcpu

The percentage of CPU time used by this process during the last scheduling interval. The default heading for this column is %CPU.

pgid

The process group ID number of the process group to which this process belongs.

pid

The process ID number of the process.

ppid

The process ID number of the parent process.

pri

The priority of the process. The meaning of the value depends on the process scheduling class; see cls, above, and rtsched(1).

prmid

The PRM process resource group ID number.

prmgrp

The PRM process resource group name.

rgid

The group ID number of the real process owner.

rgroup

The group name of the real process owner.

ruid

The user ID number of the real process owner.

pset

The processor set ID on which this process is running.

ruser

The login name of the real process owner.

sid

The session ID number of the session to which this process belongs.

state

The state of the process:

0

Nonexistent

S

Sleeping

W

Waiting

R

Running

I

Intermediate

Z

Terminated

T

Stopped

X

Growing

The default heading for this column is S.

stime

Starting time of the process. If the elapsed time is greater than 24 hours, the starting date is displayed instead.

sz

The size in physical pages of the core image of the process, including text, data, and stack space. Physical page size is defined by _SC_PAGE_SIZE in the header file <unistd.h> (see sysconf(2) and unistd(5)).

time

The cumulative execution time for the process.

tty

The controlling terminal for the process. The default heading for this column is TT if -o is specified and TTY otherwise.

uid

The user ID number of the effective process owner.

user

The login name of the effective process owner.

vsz

The size of the process in (virtual) memory in kilobytes (1024 byte units).

wchan

The event for which the process is waiting or sleeping; if there is none, a hyphen (-) is displayed.

Notes

ps prints the command name and arguments given at the time of the process was created. If the process changes its arguments while running (by writing to its argv array), these changes are not displayed by ps.

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 column, and used in computing the value for the etime column, is the time when the process was forked, not the time when it was modified by exec().

To make the ps output safer to display and easier to read, all control characters in the comm and args columns are displayed as "visible" equivalents in the customary control character format, ^x.

The default length of the COMMAND field is 128 (including the null terminator). This can be configured by setting DEFAULT_CMD_LINE_WIDTH=value in the /etc/default/ps file. The value of DEFAULT_CMD_LINE_WIDTH should be between 64 and 1020. However, when the comm column is displayed, by default, the length of the COMMAND field will be 14 characters. If the environment variable PS_CMD_BASENAME is defined, then the length of the COMMAND field will be between 64 and 255 characters.

Under UNIX Standard (see standards(5)) environment, the following behavioral changes occur:

  • The TIME column format changes from mmmm:ss to [dd-]hh:mm:ss.

  • When the comm, args, user, and prmgrp fields are included by default or the -f or -l flags are used, the column headings of those fields change to CMD, CMD, USER, and PRMGRP, respectively.

  • -a, -d, and -g will select processes based on session rather than on process group.

  • The uid or user column displayed by -f or -l will display effective user rather than real user.

  • The -u option will select users based on effective UID rather than real UID.

  • The -C and -H options, while they are not part of the UNIX Standard, are enabled.

EXTERNAL INFLUENCES

For information about the UNIX standard environment, see standards(5).

Environment Variables

LC_TIME determines the format and contents of date and time strings. If it is not specified or is null, it defaults to the value of LANG.

If LANG is not specified or is null, it defaults to C (see lang(5)).

If any internationalization variable contains an invalid setting, all internationalization variables default 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 see if a certain process exists on the machine, such as the cron clock daemon, check the far right column for the command name, cron, or try

ps -f -C cron

WARNINGS

Processes can change while ps is running. The ps command displays processes at only a snapshot in time. Data printed for defunct processes is irrelevant.

If two special files for terminals are located at the same select code, that terminal may be reported with either name. The user can select processes with that terminal using either name.

Users of ps must not rely on the exact field widths and spacing of its output, as these will vary depending on the system, the release of HP-UX, and the data to be displayed.

When non-standard options are mixed with standard options, then the behavior may be non-standard.

DEPENDENCIES

HP Process Resource Manager

The -P and -R options require the optional HP Process Resource Manager (PRM) software to be installed and configured. See prmconfig(1) for a description of how to configure HP PRM, and prmconf(4) for the definition of "process resource group."

If HP PRM is not installed and configured and -P or -R is specified, a warning message is displayed and (for -P) hyphens (-) are displayed in the prmid and prmgrp columns.

FILES

/dev

Directory of terminal device files

/etc/passwd

User ID information

/var/adm/ps_data

Internal data structure

SEE ALSO

kill(1), nice(1), acctcom(1M), exec(2), exit(2), fork(2), sysconf(2), standards(5), unistd(5).

HP Process Resource Manager: prmconfig(1), prmconf(4) in HP Process Resource Manager User's Guide.

STANDARDS COMPLIANCE

ps: SVID2, XPG2, XPG3, XPG4

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.