BSD (mac X) version
ps [-aACcefhjlMmrSTuvwx] [-O fmt] [-o fmt] [-p pid] [-t tty] [-U username] ps [-L]

Default sorted by controlling terminal, then by process ID.

The information displayed is selected based on a set of keywords (see -L -O and -o ). The default output format includes, for each process, the process' ID, controlling terminal, cpu time (including both user and system time), state, and associated command.

The process file system (see procfs(5) ) should be mounted when ps is executed, otherwise not all information will be available.
-h Repeat header as often as necessary
-M display the threads corresponding to each task.
-m Sort by memory usage
-r Sort by current cpu usage

-a all users
-A All users, including those without controlling terminals.
-c command column contains the executable name, rather than the full command line.
-C cpu percentage is calculated by using a ``raw'' cpu calculation that ignores ``resident'' time (this normally has no effect).
-S process time is calculated by summing all exited children to their parent process.
-e environment
-j user, pid, ppid, pgid, sess, jobc, state, tt, time and command.
-l uid, pid, ppid, cpu, pri, nice, vsz, rss, wchan, state, tt, time and command.
-u user, pid, %cpu, %mem, vsz, rss, tt, state, start, time and command.
Sort by cpu usage
-v pid, state, time, sl, re, pagein, vsz, rss, lim, tsiz, %cpu, %mem and command.
Sort by memory usage
 
 /bin/ps -j
USER      PID  PPID  PGID   SESS JOBC STAT  TT       TIME COMMAND
dgerman  6289  6288  6289 1b00058    1 S     p1    0:00.03 -bash
dgerman   731   730   731 1aff9e0    1 S     p2    0:00.02 -bash
dgerman   751   731   751 1aff9e0    1 S+    p2    3:01.68 -bash
dgerman  6455   751   751 1aff9e0    1 S+    p2    0:00.00 sleep 1


 /bin/ps -l
  UID   PID  PPID CPU PRI NI      VSZ    RSS WCHAN  STAT  TT       TIME COMMAND
  501  6289  6288   0  31  0    27812    844 -      S     p1    0:00.04 -bash
  501   731   730   0  31  0    27812    792 -      S     p2    0:00.02 -bash
  501   751   731   0  31  0    27812    492 -      S+    p2    3:01.86 -bash
  501  6644   751   0  31  0    27244    340 -      S+    p2    0:00.00 sleep 1

 /bin/ps -u
USER      PID %CPU %MEM      VSZ    RSS  TT  STAT STARTED      TIME COMMAND
dgerman   751   0.4  0.1    27812    492  p2  S+   Mon11AM   3:01.95 -bash
dgerman  6743   0.3  0.0    27244    340  p2  S+    6:01PM   0:00.00 sleep 1
dgerman  6289   0.3  0.1    27812    844  p1  S     5:58PM   0:00.04 -bash
dgerman   731   0.0  0.1    27812    792  p2  S    Mon11AM   0:00.02 -bash

 /bin/ps -v
  PID STAT      TIME  SL  RE PAGEIN      VSZ    RSS   LIM     TSIZ %CPU %MEM COMMAND
 6289 S      0:00.04   0 512      0    27812    844     -        0   0.3  0.1 -bash
  731 S      0:00.02   0 512      0    27812    792     -        0   0.0  0.1 -bash
  751 S+     3:02.09   0 512      0    27812    492     -        0   0.0  0.1 -bash
 6882 S+     0:00.00   0 1104     0    27244    340     -        0   0.0  0.0 sleep 1
-o Display keywords specific info appended with an equals = sign and a string.
-O Add the information associated with the space or comma separated list of keywords specified, after the process ID, in the default information display.
-p process ID.
-x exclude pruocesses with controlling terminals.
-T attached to the device assciated with the standard input.
-t specified terminal device.
-U specified username.
-w 132 columns, specified more than once, ps will use as many columns as necessary without regard for your window size.
%cpu The cpu utilization of the process; this is a decaying average over up to a minute of previous (real) time. Since the time base over which this is computed varies (since processes may be very young) it is possible for the sum of all %CPU fields to exceed 100%.
%mem percentage of real memory used
flags The flags associated with the process as in the include file :
P_ADVLOCK 00001 Process may hold a POSIX advisory lock
P_CONTROLT 00002 Has a controlling terminal
P_INMEM 00004 Loaded into memory
P_NOCLDSTOP 00008 No SIGCHLD when children stop
P_PPWAIT 00010 Parent is waiting for child to exec/exit
P_PROFIL 00020 Has started profiling
P_SELECT 00040 Selecting; wakeup/waiting danger
P_SINTR 00080 Sleep is interruptible
P_SUGID 00100 Had set id privileges since last exec
P_SYSTEM 00200 System proc: no sigs, stats or swapping
P_TIMEOUT 00400 Timing out during sleep
P_TRACED 00800 Debugged process being traced
P_WAITED 01000 Debugging process has waited for child
P_WEXIT 02000 Working on exiting
P_EXEC 04000 Process called exec
P_NOSWAP 08000 Another flag to prevent swap out
P_PHYSIO 10000 Doing physical I/O
P_OWEUPC 20000 Owe process an addupc() call atn next ast
P_SWAPPING 40000 Process is being swapped
lim soft limit on memory used, specified via a call to setrlimit(2).
lstart exact time the command started, using the ``%c'' format described in strftime(3).
nice scheduling increment (see setpriority(2)).
rss real memory (resident set) size of the process (in 1024 byte units).
start time the command started. If the command started less than 24 hours ago, the start time is displayed using the ``%l:ps.1p'' format described in strftime(3). If the command started less than 7 days ago, the start time is displayed using the ``%a6.15p'' format.
Otherwise, the start time is displayed using the ``%e%b%y'' format.
state state is given by a sequence of letters, for example, RWNA . The first letter indicates the run state of the process:
I idle (sleeping for longer than about 20 seconds).
R runnable .
S sleeping for less than about 20 seconds.
T stopped .
U uninterruptible wait.
Z dead (a ``zombie'').
Additional characters after these, if any, indicate additional state information:
+ in the foreground process group of its control terminal.
< raised CPU scheduling priority.
> specified a soft limit on memory requirements and is currently exceeding that limit; such a process is (necessarily) not swapped.
A asked for random page replacement (VA_ANOM, from vadvise(2), for example, lisp(1) in a garbage collect).
E trying to exit.
L pages locked in core (for example, for raw I/O).
N reduced CPU scheduling priority (see setpriority(2)).
S asked for FIFO page replacement (VA_SEQL, from vadvise(2), for example, a large image processing program using virtual memory to sequentially address voluminous data).
s a session leader.
V suspended during a vfork.
W swapped out.
X being traced or debugged.
tt An abbreviation for the pathname of the controlling terminal, if any. consisting of the three letters following /dev/tty, or, for the console, con. followed by a - if the process can no longer reach that controlling terminal (i.e., it has been revoked).
wchan The event (an address in the system) on which a process waits. When printed numerically, the initial part of the address is trimmed off and the result is printed in hex, for example, 0x80324000 prints as 324000. When printing using the command keyword, a process that has exited and has a parent that has not yet waited for the process (in other words, a zombie) is listed as ``'', and a process which is blocked while trying to exit is listed as ``''. Ps makes an educated guess as to the file name and arguments given when the process was created by examining memory or the swap area. The method is inherently somewhat unreliable and in any event a process is entitled to destroy this information, so the names cannot be depended on too much. The ucomm (accounting) keyword can, however, be depended on.
KEYWORDS /bin/ps -L
%cpu (alias pcpu)
%mem (alias pmem)
acflag accounting flag (alias acflg)
command and arguments
nice nice value (alias ni)
pri scheduling priority
upr scheduling priority on return from system call (alias usrpri)
rtprio realtime priority
(101 = not a realtime process)
cpu short-term cpu usage factor
(for scheduling)
flags process flags, hex (alias f)
inblk total blocks read (alias inblock)
oublk total blocks written (alias oublock)
jobc job control count
ktrace tracing flags
ktracep tracing vnode
lim memoryuse limit
msgrcv total messages received
(reads from pipes/sockets)
msgsnd total messages sent
(writes on pipes/sockets)
nsigs total signals taken (alias nsignals)
nswap total swaps in/out
nvcsw total voluntary context switches
nivcsw total involuntary context switches
nwchan wait channel (as an address)
p_ru resource usage
(valid only for zombie)
paddr swap address
pagein pageins (same as majflt)
majflt total page faults
minflt total page reclaims
poip pageouts in progress
pid process ID
ppid parent process ID
re core residency time
(in seconds; 127 = infinity)
rlink reverse link on run queue, or 0
rss resident set size
rsz resident set size + (text size / text use count) (alias rssize)
tsiz text size (in Kbytes)
vsz virtual size in Kbytes (alias vsize)
sess session pointer
sig pending signals (alias pending)
sigcatch caught signals (alias caught)
sigignore ignored signals (alias ignored)
sigmask blocked signals (alias blocked)
sl sleep time (in seconds; 127 = infinity)
lstart time started
start time started
state symbolic process state (alias stat)
svgid saved gid from a setgid executable
svuid saved uid from a setuid executable
time accumulated cpu time, user + system
(alias cputime)
tty control terminal full name of
tt two letter abbreviation
tdev control terminal device number
tpgid control terminal process group ID
tsess control terminal session pointer
uprocp process pointer
logname login name of user who started the process
ruser user name (from ruid)
user user name (from uid)
ucomm name to be used for accounting
uid effective user ID
ruid real user ID
pgid process group number
rgid real group ID
wchan wait channel (as a symbolic name)
xstat exit or stop status
(valid only for stopped or zombie process)


FILES
/dev special files and device names
/var/run/dev.db /dev name database
/var/db/kvm_kernel.db system namelist database
/proc the mount point of procfs(5)
SEE kill(1), w(1), kvm(3), strftime(3), procfs(5), pstat(8)

ps cannot run faster than the system and is run as any other scheduled process, the information it displays can never be exact. April 18, 1994 4th Berkeley Distribution