ps - process status
ps [-aAcdefjlLPRy] [-o property[=[title]], ...] ... [-gGpstuU criteria, ...] ... [-r sysname]
Ps prints certain indicia about active processes. If no options are specified, all processes on the current terminal are selected; /usr/5bin/posix/ps and /usr/5bin/posix2001/ps further restrict this to processes owned by the invoking user. The selection can be changed by adding criteria with the options below; when a process satifies any criterion, it is selected. A criteria string can consist of multiple criteria separated by blanks or commas.
By default, ps prints the process id, controlling terminal device, cumulative execution time and command of processes.
The ps command accepts the following options:
-a Selects all processes with a controlling terminal device, except for session leaders. -c Adds scheduling class and priority to the output. This is the default with /usr/5bin/s42/ps. See below for the meaning of columns. -d Selects all processes except session leaders. -e Selects all processes. -f Full listing; adds user name, parent process id, processor utilization, and the time when the process was started. See below for the meaning of columns. -g pgrplist For /usr/5bin/ps and /usr/5bin/s42/ps, all processes that belong to one of the process groups ids in pgrplist are selected; for /usr/5bin/posix/ps and /usr/5bin/posix2001/ps, all processes that belong to one of the session ids in group. -j Adds process group id and session id to the output. See below for the meaning of columns. -l Long listing; adds process flags, process state, numeric user id, parent process id, processor utilization, priority, nice value, core address, memory size in pages and the event waited for. See below for the meaning of columns. -p pidlist Selects all processes with one of the given process ids. -r sysname Change the root directory to sysname, which may be either an absolute pathname or the basename component of a mounted file system. Requires presence of a selection criterion. -s sidlist Selects all processes that belong to one of the session ids in sidlist. -t device Selects all processes with the current terminal device. This may be the device name with either /dev/ or /dev/tty omitted, as in ttyS2 or S2 for /dev/ttyS2. -u uidlist Selects all processes with one of the given user ids, which may be symbolic or numeric. The real user id is used with /usr/5bin/ps and /usr/5bin/s42/ps, the effective user id with /usr/5bin/posix/ps and /usr/5bin/posix2001/ps. The following options have been introduced by POSIX.2: -A Selects all processes. -G gidlist Selects all processes that have one of the specified real group ids, which may be symbolic or numeric. -o property[=[title]],... The output is changed to reflect the named property. Multiple properties can be given, separated by blanks or commas; it is also possible to specify multiple -o options. Normally, the default property description is written in the first output line. If the = character is present, but the title is missing in all format specifications, no descriptions are printed; if a title is given, it is used instead of the default. See below for valid property strings. -U uidlist Selects all processes with one of the given real user ids, which may be symbolic or numeric. The following options are extensions: -L Prints information on lightweight processes (LWPs); adds lightweight process id, lightweight process time, and, if -f is also present, the number of lightweight processes. See below for the meaning of columns. -P Prints the processor on which the process is currently running. Disables printing of flags and memory address. -R Resource usage format; prints process id, memory and resident set size, buffer reads and writes, messages sent and received, user and system time, and command. See below for the meaning of columns. -y Modifies the -l output format; process flags, address and size in pages are omitted, and resident set size and memory size in kilobytes are printed instead.
The meaning of columns and column headings for the -c, -f, -j, -l and -P options are as follows (the letters given in parentheses specify which option causes the column to appear; all means that the column is always printed):
F (l) Flags associated with the process (octal and additive): 01 in core; 02 system process; 04 locked in core (e.g. for physical I/O); 10 being swapped; 20 being traced by another process. S (l) The state of the process: O running on a processor; R runnable (on run queue); S sleeping; I intermediate; Z terminated; T stopped; X allocating memory. UID (f,l) The real user ID of the process owner, or, for /usr/5bin/posix/ps and /usr/5bin/posix2001/ps, the effective user ID. With the -l option, a numeric ID is printed, otherwise the user name. PID (all) The process id of the process; as in certain cults it is possible to kill a process if you know its true name. PPID (f,j,l) The process ID of the parent process. PGID (j) The process group ID of the process. SID (j) The session ID of the process. LWP (L) The lightweight process ID of the process. NLWP (fL) The number of lightweight processes in the process. PSR (P) The processor on which the process is currently running. C (f,l) Processor utilization for scheduling. CLS (c) Scheduling class. PRI (c,l) Priority. With -l, high numbers mean low priority. With -c, high numbers mean high priority; time-sharing processes have priorities below 60; for real-time processes, the priority is computed as 100 + scheduling priority. NI (l) Nice value, used in priority computation. ADDR (l) The core address of the process. RSS (ly) The amount of memory in kilobytes currently present in core. SZ (l,R) The size in pages of the core image of the process. If the -y option is also given, the size is printed in kilobytes. MRSZ (R) The amount of memory in pages currently present in core. PFLTS (R) The number of major page faults that have occurred with the process. BUFR (R) Buffer reads performed on behalf of the process. BUFW (R) Buffer writes performed on behalf of the process. MRCV (R) Messages received by the process. MSND (R) Messages sent by the process. WCHAN (l) The event for which the process is waiting or sleeping; if blank, the process is running. STIME (f) The time when the process was started. TTY (all) The controlling tty for the process. TIME (all) The cumulative execution time for the process. LTIME (L) The cumulative execution time for the lightweight process. UTIME (R) The cumulative time the process spent in user mode. KTIME (R) The cumulative time the process spent in system (kernel) mode. COMD (all) The command name; with the -f option, the command line. The heading 'CMD' is printed for /usr/5bin/posix/ps and /usr/5bin/posix2001/ps; the heading 'COMMAND' is printed if the SYSV3 environment variable is set and the -l option is not present.
A process that has exited and has a parent, but has not yet been waited for by the parent is marked <defunct>.
For the -o option, the following properties (listed with their default column headings) can be given:
user USER Effective user name. ruser RUSER Real user name. group GROUP Effective group name. rgroup RGROUP Real group name. pid PID Process id. ppid PPID Parent process id. pgid PGID Process group id. sid SID Session id. class CLASS Scheduling class. pcpu %CPU Processor usage in percent. vsz VSZ Memory usage in kilobytes. nice NI Nice value. etime ELAPSED Time elapsed since the process was started. time TIME Cumulative execution time. tty TTY Controlling terminal device. comm COMMAND The first command line argument. args COMMAND Command line arguments separated by spaces. f F Process flags. s S Process state. c C Processor utilization for scheduling. uid UID Numeric effective user id. ruid RUID Numeric real user id. gid GID Numeric effective group id. rgid RGID Numeric real group id. pri PRI Priority; high numbers mean high priority. opri PRI Priority; high numbers mean low priority. psr PSR Processor. addr ADDR Core address. osz SZ Memory size in pages. wchan WCHAN Event for which the process is waiting. stime STIME Start time of the process (may contain whitespace). rss RSS Resident set size in kilobytes. pmem %MEM Memory usage in percent. fname COMMAND The first eight characters of the executable file for the process.
For those properties that correspond to user or group names, the numeric id is printed if the name does not fit into the column width.
LANG, LC_ALL See locale(7). LC_CTYPE Determines the set of printable characters and the character width. Non-printable characters in arguments and file names are dropped if writing to a terminal. LC_TIME Affects the format of date and time strings printed. SYSV3 Changes the text of some headings as described above.
/etc/passwd Used for converting numeric and symbolic user ids. /etc/group Used for converting numeric and symbolic group ids. /etc/default/ps
nice(1), kill(1), priocntl(1), proc(5), locale(7)
Things can change while ps is running; the picture it gives is only a close approximation to reality.
|Heirloom Toolchest||PS (1)||10/13/05|