ps Command Purpose Shows current status of processes. Syntax ps [ -A ] [ -a ] [ -d ] [ -e ] [ -f ] [ -k ] [ -l ] [ -F Format ] [ -G Glist ] [ -g Glist ] [ -p Plist ] [ -t Tlist ] [ -U Ulist ] [ -u Ulist ] ps [ a ] [ c ] [ e ] [ ew ] [ eww ] [ g ] [ n ] [ U ] [ w ] [ x ] [ l | s | u | v ] [ t Tty ] [ ProcessNumber ] Description The ps command writes certain information about active processes to standard output. Without flags, the ps command displays information about the current workstation. The -f,-F, l,-l, s, u, and v flags deter- mine only what information is provided about a process; they do not determine which processes are listed. The l, s, u, and v flags are mutually exclusive. With the -f flag, the ps command determines what the command name and parameters were when the process was created, by examining memory or the paging area. If the ps command cannot find this information, the command name stored in the kernel is displayed in square brackets. The column headings in the ps command listing have the following meanings (the letters after each heading indicate which flags cause that heading to appear): F (-l, l) Flags (hexadecimal and additive) associated with the process are in the F Field table. ----------------------------------------------------------------------------------- |F Field Table | | | ----------------------------------------------------------------------------------- |Flags |Hexadecimal Value |Definition | ----------------------------------------------------------------------------------- |SLOAD |0x00000001 |Indicates that the process is operating | | | |in core memory. | ----------------------------------------------------------------------------------- |SNOSWAP |0x00000002 |Indicates that the process cannot be | | | |swapped out. | ----------------------------------------------------------------------------------- |STRC |0x00000008 |Indicates that the process is being | | | |traced. | ----------------------------------------------------------------------------------- |SWTED |0x00000010 |Indicates that the process stopped whil | | | | | | | |being traced. | ----------------------------------------------------------------------------------- |SFWTED |0x00000020 |Indicates that the process stopped | | | |after a call to the fork subroutine, | | | |while being traced. | ----------------------------------------------------------------------------------- |SEWTED |0x00000040 |Indicates that the process stopped | | | |after a call to the exec subroutine, | | | |while being traced. | ----------------------------------------------------------------------------------- |SLWTED |0x00000080 |Indicates that the process stopped | | | |after a call to the load or unload | | | |subroutine, while being traced. | ----------------------------------------------------------------------------------- |SFIXPRI |0x00000100 |Indicates that the process has a fixed | | | |priority, ignoring the pcpu field | | | |descriptor. | ----------------------------------------------------------------------------------- |SKPROC |0x00000200 |Indicates a Kernel process. | ----------------------------------------------------------------------------------- |SOMASK |0x00000400 |Indicates restoration of the old mask | | | |after a signal is received. | ----------------------------------------------------------------------------------- |SWAKEONSIG |0x00000800 |Indicates that the signal will abort | | | |the sleep subroutine. The contents must | | | |not be equal to those of the PCATCH | | | |flag. The contents of both PCATCH and | | | |SWAKEONSIG must be greater than those | | | |of PMASK. | ----------------------------------------------------------------------------------- |SUSER |0x00001000 |Indicates that the process is in user | | | |mode. | ----------------------------------------------------------------------------------- |SLKDONE |0x00002000 |Indicates that the process has done | | | |locks. | ----------------------------------------------------------------------------------- |STRACING |0x00004000 |Indicates that the process is a | | | |debugging | | | |process. | ----------------------------------------------------------------------------------- |SMPTRACE |0x00008000 |Indicates multi-process debugging. | ----------------------------------------------------------------------------------- |SEXIT |0x00010000 |Indicates that the process is exiting. | ----------------------------------------------------------------------------------- |SSEL |0x00020000 |Indicates that the processor is | | | |selecting: | | | |wakeup/waiting danger. | ----------------------------------------------------------------------------------- |SORPHANPGRP |0x00040000 |Indicates an orphaned process group. | ----------------------------------------------------------------------------------- |SNOCNTLPROC |0x00080000 |Indicates that the session leader | | | |relinquished the controlling terminal. | ----------------------------------------------------------------------------------- |SPPNOCLDSTOP |0x00100000 |Indicates that the SIGHLD signal is not | | | |sent to the parent process when a child | | | |stops. | ----------------------------------------------------------------------------------- |SEXECED |0x00200000 |Indicates that process has been run. | ----------------------------------------------------------------------------------- |SJOBSESS |0x00400000 |Indicates that job control was used in | | | |the current session. | ----------------------------------------------------------------------------------- |SJOBOFF |0x00800000 |Indicates that the process is free from | | | |job | | | |control. | ----------------------------------------------------------------------------------- |PSIGDELIVERY |0x01000000 |Indicates that the process is used by | | | |the | | | |program-check handler. | ----------------------------------------------------------------------------------- |F Field Table | | | ----------------------------------------------------------------------------------- |Flags |Hexadecimal Value |Definition | ----------------------------------------------------------------------------------- |SRMSHM |0x02000000 |Indicates that the process removed | | | |shared memory during a call to the exit | | | |subroutine. | ----------------------------------------------------------------------------------- |SSLOTFREE |0x04000000 |Indicates that the process slot is | | | |free. | ----------------------------------------------------------------------------------- |SNOMSG |0x08000000 |Indicates that there are no more | | | |uprintf | | | |subroutine messages. | ----------------------------------------------------------------------------------- S (-l, l), STAT (s, u, v) The state of the process: 0 Nonexistent S Sleeping W Waiting R Running I Intermediate Z Canceled T Stopped K Available kernel process X Growing. UID (-l, l) The user ID of the process owner. USER (-f, u) The login name of the process owner. PID (all) The process ID of the process. PPID (-f, l, -l) The process ID of the parent process. C (-f, l, -l ) CPU utilization of process, incremented each time the system clock ticks and the process is found to be running. Value is decayed by the scheduler by dividing it by 2. CPU utili- zation is used in determining process scheduling priority. Large values indicate a CPU intensive process and result in lower pro- cess priority whereas small values indicate an I/O intensive pro- cess and result in a more favorable priority. STIME (-f, u) Starting time of the process. The LANG environment variables control the appearance of this field. PRI (-l, l) The priority of the process; higher numbers mean lower priority. NI (-l, l) Nice value; used in calculating priority. ADDR (-l, l) The segment number of the process stack, if normal; if a kernel process, the address of the preprocess data area. SZ (-l, l) The size in 1KB units of the core image of the pro- cess. WCHAN (-l) The event for which the process is waiting or sleep- ing; if blank, the process is running. WCHAN (l) Event on which process is waiting (an address in the system). A symbol is chosen that classifies the address, unless numerical output is requested. TTY (all) The controlling workstation for the process: - The process is not associated with a workstation. ? Unknown. Number The TTY number. For example, a value of 2 indicates TTY2. TIME (all) The total execution time for the process. CMD (-f,-l, l), COMMAND (s, u, v) The command name; the full com- mand name and its parameters are displayed with the -f flag. SSIZ (s) The size of the kernel stack. PGIN (v) Number of disk I/Os resulting from references by the process to pages not loaded in core. SIZE (v) Virtual size of the data section of the process (in 1KB units). RSS (v) Real-memory (resident set) size of the process (in 1KB units). LIM (v) Soft limit on memory used, specified via a call to the setrlimit subroutine. If no limit has been specified, then shown as xx. If the limit is set to the system limit, (unlimited), a value of UNLIM is displayed. TSIZ (v) Size of text (shared-program) image. TRS (v) Size of resident-set (real memory) of text. %CPU (u, v) Percentage of time the process has used the CPU since the process started. The value is computed by dividing the time the process uses the CPU by the elapsed time of the process. (Because the time base over which this data is computed varies, the sum of all %CPU fields can exceed 100%.) %MEM (u, v) Percentage of real memory used by this process. A process that has exited and has a parent that has not yet wait- ed for the process is marked . A process that is blocked trying to exit is marked . The ps command at- tempts to determine the file name and arguments given when the process was created by memory or by the swap area. Note: The process can change while the ps command is running. Some data displayed for defunct processes is irrelevant. Flags The following flags are preceded by a - (minus): -A Writes to standard output information about all processes. -a Writes to standard output information about all processes, ex- cept the process group leaders and processes not associated with a terminal. -d Writes information to standard output about all processes, ex- cept the process group leaders. -e Writes information to standard output about all processes, ex- cept kernel processes. -f Generates a full listing. -F Format Displays information in the format specified by the Format variable. Multiple field specifiers can be specified for the Format variable. The Format variable is either a comma- separated list of field specifiers or a list of field specifiers enclosed within a set of "" (double-quotation marks) and separat- ed from one another by a comma or by one or more spaces, or both. Each field specifier has a default header. The default header can be overridden by appending an = (equal sign) followed by the user-defined text for the header. The fields are written in the order specified on the command line in column format. The field widths are specified by the system to be at least as wide as the default or user-defined header text. If the header text is null, (such as if -F user= is specified), the field width is at least as wide as the default header text. If all header fields are null, no header line is written. The following field specifiers are recognized by the system: args Indicates the full command name being executed. All com- mand-line arguments are included, though truncation may occur. The default header for this field is COMMAND. comm Indicates the short name of the command being executed. Command-line arguments are not included. The default header for this field is COMMAND. etime Indicates the elapsed time since the process started. The elapsed time is displayed in the following format: [[ dd-]hh:]mm:ss where dd specifies the number of days, hh specifies the number of hours, mm specifies the number of minutes, and ss specifies the number of seconds. The default header for this field is ELAPSED. gname Indicates the effective group ID of the process. The tex- tual group ID is displayed. If the textual group ID cannot be obtained, a decimal representation is used. The default header for this field is GROUP. nice Indicates the decimal value of the system scheduling priori- ty of the process. The default header for this field is NI. pcpu Indicates the ratio of CPU time used to CPU time available, expressed as a percentage. The default header for this field is %CPU. pgid Indicates the decimal value of the process group ID. The default header for this field is PGID. pid Indicates the decimal value of the process ID. The default header for this field is PID. ppid Indicates the decimal value of the parent process ID. The default header for this field is PPID. rgname Indicates the real group ID of the process. The textual group ID is displayed. If the textual group ID cannot be ob- tained, a decimal representation is used. The default header for this field is RGROUP. runame Indicates the real user ID of the process. The textual user ID is displayed. If the textual user ID cannot be obtained, a decimal representation is used. The default header for this field is RUSER. time Indicates the cumulative CPU time since the process started. The time is displayed in the following format: [ dd-]hh:mm:ss where dd specifies the number of days, hh specifies the number of hours, mm specifies the number of minutes, and ss specifies the number of seconds. The default header for this field is TIME. tty Indicates the controlling terminal name of the process. The default header for this field is TT. uname Indicates the effective user ID of the process. The textu- al user ID is displayed. If the textual user ID cannot be ob- tained, a decimal representation is used. The default header for this field is USER. vsz Indicates, as a decimal integer, the size in kilobytes of the process in virtual memory. The default header for this field is VSZ. Otherwise, multiple fields in a specified format can be displayed by the Format variable, including field descriptors. If field descriptors are used in the Format variable, it must be enclosed in double quotation marks (" "). The following table shows how field descriptors correspond to field specifiers: Field Field Default Descriptors Specifiers Headers %a args COMMAND %c comm COMMAND %t etime ELAPSED %G gname GROUP %n nice NI %c pcpu %CPU %r pgid PGID %p pid PID %P ppid PPID %g rgname RGROUP %u runame RUSER %x time TIME %y tty TTY %U uname USER %z vsz VSZ -G Glist Writes information to standard output only about processes that are in the process groups listed for the Glist variable. The Glist variable is either a comma-separated list of process group identifiers or a list of process group identifiers enclosed in double quotation marks (" ") and separated from one another by a comma or by one or more spaces. This flag is equivalent to the -g Glist flag. -g Glist This flag is equivalent to the -G Glist flag. -k Lists kernel processes. -l Generates a long listing. See also the l flag. -p Plist Displays only information about processes with the pro- cess numbers specified for the Plist variable. The Plist vari- able is either a comma separated list of process ID numbers or a list of process ID numbers enclosed in double quotation marks (" ") and separated from one another by a comma or by one or more spaces, or both. -t Tlist Displays only information about processes associated with the workstations listed in the Tlist variable. The Tlist variable is either a comma separated list of workstation identif- iers or a list of workstation identifiers enclosed in double quo- tation marks (" ") and separated from one another by a comma or by one or more spaces, or both. -U Ulist Displays only information about processes with the user ID numbers or login names specified for the Ulist variable. The Ulist variable is either a comma-separated list of user IDs or a list of user IDs enclosed in double quotation marks (" ") and separated from one another by a comma and one or more spaces. In the listing, the ps command displays the numerical user ID unless the -f flag is used; then the command displays the login name. This flag is equivalent to the -u Ulist flag. See also the u flag. -u Ulist This flag is equivalent to the -U Ulist flag. The following flags are not preceded by a - (minus): a Displays information about all processes with terminals (ordi- narily only the user's own processes are displayed). c Displays the command name, as stored internally in the system for purposes of accounting, rather than the command parameters, which are kept in the process address space. e Displays the environment as well as the parameters to the com- mand, up to a limit of 80 characters. ew Wraps display from the e flag one extra line. eww Wraps display from the e flag as many times as necessary. g Displays all processes. l Displays a long listing having the F, S, UID, PID, PPID, C, PRI, NI, ADDR, SZ, PSS, WCHAN, TTY, TIME, and CMD fields. n Displays numerical output. In a long listing, the WCHAN field is printed numerically rather than symbolically. In a user list- ing, the USER field is replaced by a UID field. s Displays the size (SSIZ) of the kernel stack of each process (for use by system maintainers) in the basic output format. t Tty Displays processes whose controlling TTY is X, which should be specified as printed by the ps command; that is, 0 for termi- nal /dev/tty/0, hft/0 for /dev/hft/0, and pts/2 for /dev/pts/2. The t flag must be the last flag specified on the command line. U Updates the ps internal database file, /etc/ps_data, if the user can write to it. No error message is displayed. The ps command keeps an internal database file called /etc/ps_data to compare names verses system IDs. If the /etc/passwd file has been modified, the ps command tries to update its internal data- base file. However, the /etc/ps_data file is not normally writ- able. If the database is out of date and the ps command cannot write to the database file, then the /etc/passwd file is read manually. System administrators can either put the entry ps U in the /etc/rc file to ensure the file is up-to-date after the sys- tem has been restarted or change the mode of the /etc/ps_data file to 666. u Displays user-oriented output. This includes the USER, PID, %CPU, %MEM, SZ, RSS, TTY, STAT, STIME, TIME, and COMMAND fields. v Displays the PGIN, SIZE, RSS, LIM, TSIZ, TRS, %CPU, %MEM fields. w Specifies a wide-column format for output (132 columns rather than 80). If repeated, (for example, ww), uses arbitrarily wide output. This information is used to decide how much of long com- mands to print. x Displays processes with no terminal. Exit Status This command returns the following exit values: 0 Successful completion. >0 An error occurred. Examples 1. To display all processes, enter: ps -e -f 2. To list processes owned by specific users, enter: ps -f -l -ujim,jane,su 3. To list processes that are associated with the /dev/console and /dev/hft/1 ttys, enter: ps -t console,hft/1 4. To list processes not associated with a terminal, enter: ps -t - 5. To display a specified format with field specifiers, enter: ps -F runame,pid,ppid=parent,args The output is: RUSER PID parent COMMAND helene 34 12 ps -F runame,pid,ppid=parent,args 6. To display a specified format with field descriptors, enter: ps -F "< %u > %p %y : %a" The output is: < RUSER > PID TT : COMMAND < helene > 34 pts/3 : ps -F < %u > %p %y : %a Implementation Specifics This command is part of Base Operating System (BOS) Runtime. Files /etc/passwd Specifies user ID information. /etc/ps_data Specifies internal data structure. /dev/pty* Indicates workstation (PTY) names. /dev/tty* Indicates workstation (TTY) names. Related Information The kill command, nice command. AIX Performance Monitoring and Tuning Commands in AIX Version 3.2 Performance Monitoring and Tuning Guide.