ps - Report the status of processes.
ps(1) ps(1) NAME ps - report process status SYNOPSIS ps [-adeflP] [-g grplist] [-p proclist] [-R prmgrplist] [-t termlist] [-u uidlist] XPG4 SYNOPSIS ps [-aAcdefHjlP] [-C cmdlist] [-g grplist] [-G gidlist] [-n namelist] [-o format] [-p proclist] [-R prmgrplist] [-s sidlist] [-t termlist] [-u uidlist] [-U uidlist] 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 XPG4 environments, the description provided here documents the default behavior. Refer to the UNIX95 variable under EXTERNAL INFLUENCES for additional information on XPG4 behavior. (none) Select those processes associated with the current terminal. -A (XPG4 Only.) Select all processes. (Synonym for -e.) -a Select all processes except process group leaders and processes not associated with a terminal. -C cmdlist (XPG4 Only.) 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 (XPG4 Only.) Select processes whose real group ID numbers or group names are given in gidlist. -n namelist (XPG4 Only.) 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 (XPG4 Only.) 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 effective user ID numbers or login names are given in uidlist. -U uidlist (XPG4 Only.) Select processes whose real user ID numbers or login names are given in uidlist. If any of the -a, -A, -d, or -e options is specified, the -C, -g, -G, -p, -R, -t, -u, 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, 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, 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 (XPG4 Only.) Remove columns cpu and nice; replace column intpri with columns cls and pri. -j (XPG4 Only.) Add columns pgid and sid after column ppid (or pid, if ppid is not being displayed). -P Add column prmid (for -l) or prmgrp (for -f or -fl) immediately before column pid. See DEPENDENCIES. -o format (XPG4 Only.) 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 will be taken as a 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, and -P; if they are specified, they are ignored. -H (XPG4 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. 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. 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 in kilobytes (1024 byte units) of the core image of the process. See column sz, above. 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. EXTERNAL INFLUENCES Environment Variables UNIX95 specifies to use the XPG4 behavior for this command. The changes for XPG4 include support for the entire option set specified above and include the following behavioral changes: - 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 XPG4 standard, are enabled. 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 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, 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. 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.
18.222.20.247