PS(1B)

NAME
ps - (BSD) process status

SYNOPSIS

/usr/ucb/ps [-aAcglnrSuvwx] [-o property[=[title]], ...] ... [-GptU criteria, ...] ... [pid]

DESCRIPTION
Ps prints certain indicia about active processes. If no options are specified, all processes on the current terminal that are owned by the invoking user and are not session leaders are selected. Specifying -a selects other users' processes; specifying -x selects processes without controlling terminals. The selection can further 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. If the pid argument is present, output is restriced to the selected process.

By default, ps prints the process id, controlling terminal device, process status, cumulative execution time and command of processes.

The ps command accepts the following options:

-a  Selects all processes with a controlling terminal device (including session leaders).

-c  Prints the command name, as stored internally in the system for purposes of accounting, rather than the command arguments, which are kept in the process' address space. This is more reliable, if less informative, since the process is free to destroy the latter information.

-g  Includes session leaders in the output. Without this option, ps only prints ``interesting'' processes. Processes are deemed to be uninteresting if they are session leaders. This normally eliminates top-level command interpreters and processes waiting for users to login on free terminals.

-l  Long listing; adds process flags, numeric user id, parent process id, cpu usage, priority, nice value, memory and resident set size in pages and the event waited for. See below for the meaning of columns.

-n  For a user listing as selected with -u, print the numeric user ID instead of the user name.

-r  Causes only running processes to be printed.

-S  Includes the time used by children that have been waited for.

-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. Giving ? as a device name selects processes with no controlling terminal.

-u  A user oriented output is produced; adds user name, processor usage, memory and resident set size, and the time when the process was started.

-v  A version of the output containing virtual memory statistics is output; adds memory and resident set size.

-w  Increase output width. The default width of 80 columns is set to 132 if this option is given once; if given more than once, the output width is unlimited.

-x  Include processes that have no controlling terminal.

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.

-p pidlist
    Selects all processes with one of the given process ids.

-U uidlist
    Selects all processes with one of the given real user ids, which may be symbolic or numeric.

The meaning of columns and column headings are as follows:

F | 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 | The state of the process:
 |  | R | running;
 |  | S | sleeping;
 |  | I | intermediate;
 |  | Z | terminated;
 |  | T | stopped;
 |  | X | allocating memory.
UID | The effective user ID of the process owner.
USER | The name of the process owner, based on the effective user ID.
PID | The process id of the process; as in certain cults it is possible to kill a process if you know its true name.
PPID | The process ID of the parent process.
CP | Processor utilization for scheduling.
PRI | Priority. High numbers mean low priority.
NI | Nice value, used in priority computation.
ADDR | The core address of the process.
RSS | The amount of memory in pages currently present in core.
SZ | The size in pages of the core image of the process.
WCHAN | The event for which the process is waiting or sleeping; if blank, the process is running.
START | The time when the process was started.
TT | The controlling tty for the process.
TIME | The cumulative execution time for the process, including its terminated children if -S is present.
COMMAND | The command line; with the -c option, the command name.

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.
rss | RSS | Resident set size in kilobytes.
pmem | %MEM | Memory usage in percent.
fname | COMMAND | The first 16 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.

ENVIRONMENT VARIABLES

COLUMNS
    Overrides the default output 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.

FILES

/etc/passwd
    Used for converting numeric and symbolic user ids.

/etc/group
    Used for converting numeric and symbolic group ids.

/etc/default/ps

/proc/

/dev/

SEE ALSO
nice(1), priocntl(1), kill(1), proc(5), locale(7)

NOTES
Things can change while ps is running; the picture it gives is only a close approximation to reality.