ps(1) ps(1) NAME ps - report process status SYNOPSIS ps [ options ] DESCRIPTION ps prints information about active processes. Without options, information is printed about processes associated with the controlling terminal. The output consists of a short listing containing only the process ID, terminal identifier, cumulative execution time, and the command name. Since a batch job doesn't have a controlling terminal, invoking ps without options from a batch job will result in an error. Otherwise, the information that is displayed is controlled by the selection of options. options accept names or lists as arguments. Arguments can be either separated from one another by commas or enclosed in double quotes and separated from one another 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 process group leaders and processes not associated with a terminal. -A Print information about every process now running. -c Print information about the scheduler properties. (See below.) -d Print information about all processes except process group leaders. -e Print information about every process now running (equivalent to -A). -f Generate a full listing. (See below for significance of columns in a full listing.) -g grplist List only process data whose process group leader's ID numbers appear in grplist. (A group leader is a process whose process ID number is identical to its process group ID number. A login shell is a common example of a process group leader.) -G grplist List only process data whose real group leader's ID numbers appears in grplist. -j Print process ID, process group ID, session ID, and job ID. The job ID is printed out in hexadecimal. When the job ID is specified, the "0x" prefix is optional. -J jidlist List information on all jobs whose IDs appear in jidlist (shows the job ID if the eoe.sw.jlimits package is installed). -l Generate a long listing. (See below.) -M If the system supports Mandatory Access Control, print the security label for each process. The -M option can be automatically be turned on by using an environmental variable LABELFLAG. Set variable to on (not case sensitive) for automatic security label information. To turn off feature set to off or NULL. -n name This argument is obsolete and is no longer used. -o format Print information according to the format specification given in format. (See below.) -P If the system supports capabilities then print the capabilities of each process. -p proclist List only process data whose process ID numbers are given in proclist. -s sesslist List information on all session leaders whose IDs appear in sesslist. -t termlist List only process data associated with the terminal given in termlist. Terminal identifiers consist of the device's name (for example, ttyd1, ttyq1). -T List data for individual kernel threads. Normally the information presented is a summation across all threads of the process. This is of use when examining POSIX threaded processes. -u uidlist List only process data whose user ID number or login name is given in uidlist. In the listing, the numerical user ID is printed unless you give the -f option, which prints the login name. -U uidlist List only process data whose real user ID number or login name is given in uidlist. -K Add an additional column showing the name of the cpuset to which the process is attached. If the process is not attached to a cpuset a "?" will appear. -k cpuset List only process data whose process ID numbers are attached to the given cpuset name. 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. 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, respectively) that causes the corresponding heading to appear (assuming the -o option is not specified); all means that the heading always appears. Note that these options determine only what information is provided for a process; they do not determine which processes are listed. If the environment variable _XPG is defined and has a numeric value greater than 0, ps operates in conformance with the X/Open XPG4 specifications. The format of the output of the -l option differs in some details from the XPG format and backward compatibility mode. The differences are explained in the table below. F (l) Flags (hexadecimal and additive) associated with the process: 001 Process is a system (resident) process. 002 Process is being traced. 004 Parent has exited or is ignoring its child's exit status. 008 Process is sleeping at a non-interruptible priority. 010 Process tracing rescheduling via par. 020 Process sysent/exit/fault/signal tracing via /proc. 040 Process is in job control stop. 080 Process is open via /proc. S (l) The state of the process: 0 Process is running on a processor. S Process is sleeping, waiting for a resource. R Process is running. Z Process is terminated and parent not waiting (wait(2)). T Process is stopped. I Process is in intermediate state of creation. X Process is waiting for memory. C Process is creating core image after error. UID (f,l) The user ID number of the process owner (the login name is printed under the -f option). PID (all) The process ID of the process (this datum is necessary in order to kill a process). PPID (f,l) The process ID of the parent process. PGID (j) Process group leader ID. This can be used with the -g option. SID (j) Session ID. This can be used with the -s option. JID (j) Job ID. This can be used with the -J option. CLS (c) Scheduling class. The values printed for CLS are two character mnemonics for the scheduler class. RT indicates real-time, TS indicates timeshare, B indicates batch, BC indicates batch critical, WL indicate weightless and GN indicates gang scheduled. C (f,l) Processor utilization for scheduling. Not printed when the -c option is used. PRI (l) The priority of the process (higher numbers mean higher priority). If the class of the process is WL, w is displayed as the priority. If the process is scheduled via miser(1) it may be b for batch or bc for batch critical. NI (l) Nice value, used in priority computation. Not printed when the -c option is used (see nice(1) and csh(1)). Only processes in the time-sharing class have a nice value. Processes in other scheduling classes have their two letter class mnemonic printed in this field (refer to CLS description above). P (l) If the process is running, gives the number of processor on which the process is executing. Contains an asterisk otherwise. This is not displayed in X/OPEN XPG4 conformance mode. ADDR (l) The physical address of the process. This is only displayed in X/OPEN XPG4 conformance mode. SZ (l) Total size (in pages) of the process, including code, data, shared memory, mapped files, shared libraries and stack. Pages associated with mapped devices are not counted. (Refer to sysconf(1) or sysconf(3C) for information on determining the page size.) RSS (l) Total resident size (in pages) of the process. Mapped devices (such as graphics) are not included. Typically, the resident set includes only those pages of the process that are physically resident in memory and have been read or modified by the process. There are two exceptions: 1. The child process of a fork(2) system call will inherit the resident set of the parent. 2. The pages of a shared memory segment which are resident and have been read or modified by any process attached to that segment, will be added to the resident size of a process attaching to the segment. This refers only to shared memory obtained via shmat(2). The page size can either be 4096 or 16384 bytes as determined by the return value of the getpagesize(2) system call. In general the larger page size is used on systems where uname(1) returns "IRIX64". This is not displayed in X/OPEN XPG4 conformance mode. WCHAN (l) The name (or address if the name is unavailable) of an event for which the process is sleeping, or in SXBRK state, (if blank, the process is running). 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.) TTY (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. CPUSET (K,k) The name of the cpuset which the process is attached. A "?" signifies a process which is not attached to a cpuset. COMMAND(all) The command name (the full command name and its arguments are printed under the -f option). A process that has exited and has a parent, but has not yet been waited for by the parent, is marked <defunct>. The -o option allows the output format to be specified under user control. The format specification must be a list of names presented as a single argument, blank- or comma-separated. Each variable has a default header. The default header can be overridden by appending an equals sign and the new text of the header. The rest of the characters in the argument are used as the header text. The fields specified are written in the order specified on the command line and should be arranged in columns in the output. The field widths are selected by the system to be at least as wide as the header text (default or overridden value). If the header text is null such as -o user=, the field width is at least as wide as the default header text. If all header text fields are null, no header line is written. The following names are recognized: ruser The real user ID of the process. user The effective user ID of the process. rgroup The real group UD of the process. group The effective group ID of the process. jid The hexadecimal value of the job ID. pid The decimal value of the process ID. ppid The decimal value of the parent process ID. pgid The decimal value of the process group ID. pcpu The ratio of CPU time used recently to the CPU time available in the same period, expressed as a percentage. This is calculated by ps over a short period of time, and as such, is only an approximation. vsz The size of the process in (virtual) memory. nice The decimal value of the system scheduling priority of the process. time The cumulative CPU time of the process. etime The elapsed time since the process was started. stime The starting time of the process. flag Flags associated with the process. state The state of the process. wchan The address of an event for which the process is waiting or sleeping. wname The name (or address if the name is unavailable) of an event for which the process is waiting or sleeping. util Processor utilization for scheduling. uid The user ID number of the process owner. cpu The processor process is currently executing on. class The scheduling class of the process. tty The name of the controlling terminal of the process (if any) in the same format used by the who utility. comm The name of the command being executed (argv[0] value) as a string. args The command with all its arguments as a string. label The MAC label of the running process. cs The name of the cpuset which the process is attached. A "?" signifies a process which is not attached to a cpuset. The file /tmp/.ps_data/.ps_data is used to improve the performance of ps by caching kernel info, and some device information. It is recreated when it is older (either the mtime or ctime) than /unix, or /dev, or when a read error occurs on the file. ps runs noticeably slower when this file isn't used, or needs to be recreated. FILES /dev /dev/tty* /etc/passwd UID information supplier /tmp/.ps_data/.ps_data internal data structure SEE ALSO capabilities(4), cpuset(5), getty(1M), gr_osview(1), gr_top(1), kill(1), miser(1), nice(1), sysconf(1), top(1), sched_setscheduler(2), sysconf(3C). WARNING Things can change while ps is running; the snapshot it gives is only true for a splitsecond, 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 order, looking for the controlling terminal and attempts to report on processes associated with the controlling terminal. In this situation, if stdin, stdout, and stderr are all redirected, ps does not find a controlling terminal, so there is no report. ps -ef may not report the actual start of a tty login session, but rather an earlier time, when a getty was last respawned on the tty line. BUGS The C and ADDR fields currently always report 0. When a machine's system time is corrected by timed or timeslave and if the correction sets the time to an earlier value, ps reports a meaningless huge or negative TIME value for the timed or timeslave processes. Page 7