top
List running processes on the system, in sorted order.
Periodically displays a list of processes on the system in sorted order. The
default key for sorting is pid, but other keys can be used instead.
SYNTAX
top [-c mode]
[-L | -l samples]
[-o key] [-O skey]
[-R | -r]
[-s delay]
[-T | -t]
[-U user]
[-u]
[-W | -w]
[-X | -x]
[[-n] nprocs]
Options
Command line option specifications are processed from left to right.
Options can be specified more than once. If conflicting options are
specified, later specifications override earlier ones. This makes it
viable to create a shell alias for top with preferred defaults speci-
fied, then override those preferred defaults as desired on the command
line.
-c mode
Set event counting mode to mode. The supported modes are:
a Accumulative mode. Count events cumulatively, starting
at the launch of top. Calculate CPU usage and CPU time
since the launch of top.
d Delta mode. Count events relative to the previous sam-
ple. Calculate CPU usage since the previous sample.
e Absolute mode. Count events using absolute counters.
n Non-event mode (default). Calculate CPU usage since the
previous sample.
-F Do not calculate statistics on shared libraries, also known as
frameworks. This substantially reduces the amount of processor
time top consumes.
-f Calculate statistics on shared libraries, also known as frame-
works (default).
-h Print command line usage information and exit.
-L Use interactive (non-logging) mode. If not running on a termi-
nal, exit with an error rather than running in logging mode.
-l samples
Use logging mode and display samples samples, even if standard
output is a terminal. 0 is treated as infinity. Rather than
redisplaying, output is periodically printed in raw form.
-n nprocs
Only display up to nprocs processes. nprocs can be speci-
fied as the last command line argument without the -n flag pre-
ceding it. However, doing so is deprecated command line usage.
-O skey
Use skey as a secondary key when ordering the process display.
See -o for key names (pid is default).
-o key
Order the process display by sorting on key in descending or-
der. A + or - can be prefixed to the key name to specify as-
cending or descending order, respectively. The supported keys
are:
cpu CPU usage.
pid Process ID (default).
prt Number of Mach ports.
reg Number of memory regions.
rprvt Resident private address space size.
rshrd Resident shared address space size.
rsize Resident memory size.
th Number of threads.
time Execution time.
uid User ID.
username Username.
vprvt Private address space size.
vsize Total memory size.
-R Do not traverse and report the memory object map for each pro-
cess. This substantially reduces the amount of processor time
top consumes.
-r Traverse and report the memory object map for each process (de-
fault).
-s delay
Set the delay between updates to delay seconds. The default
delay between updates is 1 second.
-T Do not translate uid numbers to usernames (default).
-t Translate uid numbers to usernames.
-U user
Only display processes owned by user. Either the username or
uid number can be specified.
-W Display + or - to indicate deltas (default).
-w Display delta values, rather than just + or -.
-X Run in compatibility mode.
-x Do not run in compatibility mode (default). This causes top to
display output in the same format as the version of top included
with Jaguar. Specifying this flag in combination with options
that did not exist in Jaguar's top may produce meaningless out-
put in some cases. For documentation on the usage and output of
Jaguar's top, see top(1) on a Jaguar system. When this option
is specified, all interactive key bindings are the same as in
Jaguar's top, except that the x key switches to compatibility
mode.
Deprecated_Options
-a Equivalent to -ca.
-d Equivalent to -cd.
-e Equivalent to -ce.
-k Deprecated (does nothing)
-u Equivalent to -ocpu -Otime.
DISPLAY
The first several lines of the top display show various global
state. All of the information is labeled. Following is an al-
phabetical list of global state fields and their descriptions.
CPU Percentage of processor usage, broken into user, system,
and idle components. The time period for which these per-
centages are calculated depends on the event counting mode.
Disks Number and total size of disk reads and writes.
LoadAvg Load average over 1, 5, and 15 minutes. The load average
is the average number of jobs in the run queue.
MemRegions Number and total size of memory regions, and total size of
memory regions broken into private (broken into non-library
and library) and shared components.
Networks Number and total size of input and output network packets.
PhysMem Physical memory usage, broken into wired, active, inactive,
used, and free components.
Procs Total number of processes and number of processes in each
process state.
SharedLibs Number of shared libraries, resident sizes of code and data
segments, and link editor memory usage.
Threads Number of threads.
Time Time, in YYYY/MM/DD HH:MM:SS format. When running in accu-
mulative event counting mode, the time since top started is
printed in parentheses in H:MM:SS format.
VirtMem Total virtual memory, virtual memory consumed by shared li-
braries, and number of pageins and pageouts.
Below the global state fields, a list of processes is displayed. The
fields that are displayed depend on the options that are set. Follow-
ing is an alphabetical list of fields and their descriptions.
BSYSCALL Number of BSD system calls made.
COMMAND Command name.
COW_FAULTS Number of faults that caused a page to be copied.
%CPU Percentage of processor time consumed (kernel and user).
CSWITCH Number of context switches.
FAULTS Number of faults.
MSYSCALL Number of Mach system calls made.
REG Number of memory regions.
MSGS_RCVD Number of Mach messages received.
MSGS_SENT Number of Mach messages sent.
PAGEINS Number of requests for pages from a pager.
PID Process ID.
PRT(delta) Number of Mach ports.
RPRVT(delta) Resident private memory size.
RSHRD(delta) Resident shared memory size.
RSIZE(delta) Total resident memory size, including shared pages.
TH Number of threads.
TIME Absolute processor time consumed.
UID User ID of process owner.
USERNAME Username of process owner.
VPRVT(delta) Private address space size.
VSIZE(delta) Total address space allocated, including shared pages.
Example
top -ocpu -s 5
Display processes sorted by CPU useage, updating every 5 seconds
"Venice is like eating an entire box of chocolate liqueurs at one go" - Truman Capote
Related commands:
kill - Stop a process from running
signal(3) - software signal facilities
Equivalent Linux BASH command:
top - List running processes on the system