Command line options are processed from left to right.
If conflicting options are specified, later specifications overrides .
viable to create a shell alias for top with preferred defaults , then override those preferred defaults as desired on the command line.
The first several lines show the global state.
CPU Percentage of processor usage, broken into user, system, and idle components.
Disks reads and writes.
LoadAvg over 1, 5, and 15 minutes.
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.
PhysMem 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.
Time in accumulative event counting mode, the time since top started is printed in parentheses
VirtMem Total virtual memory, virtual memory consumed by shared libraries, and number of pageins and pageouts.
Global state fields, a list of processes is displayed.
| faults causing a page to be copied.
| context switches.
| Mach messages received.
| Mach sent.
| Mach ports.
| Resident private memory size.
| Resident shared
| Total resident , including shared pages.
| BSD system calls
| Number of threads.
| Absolute processor time consumed.
| Private address space size.
| Total address space allocated, including shared pages.
When top is run in interactive mode, it is possible to control the output of top, as well as interactively send signals to processes. The interactive command syntax is terse. Each command is one character, followed by 0 to 2 arguments. Commands that take arguments prompt interactively for the arguments, and where applicable, the default value is shown in square brackets. The default value can be selected by leaving the input field blank and pressing enter. ^G escapes the interactive argument prompt, and has the same effect as leaving the input field blank and pressing enter.
other Keypresses cause a sample update.
| ^L Redraw the screen.
| n Only display processes. 0 =all
| okey sort on key in descending order. |
| Oskey skey secondary key
prt Number of Mach ports.
reg Number of memory regions.
rprvt Resident private address space size.
rshrd Resident shared
rsize Resident memory size.
th Number of threads.
time Execution time.
vsize Total memory size.
| f || frameworks
| r ||recursive (traversal)of the memory object map for each process.
|t ||translation of uid numbers to usernames.
| U O||nly display processes owned by . Either the username or uid number can be specified. To display all processes, press enter without entering a username or uid number.
| w || wide/narrow delta
| x|| deprecated/normal
| S signal pid || a number or as a name (for example, |
Default TERM. Each time a signal is successfully sent, the default signal is updated to be that signal.
|-a use -ca.
|-d use -cd.
|-e use -ce.
|-k used to turn on memory object reporting for process 0 (kernel_task), but this is now done by default.
| -u use -ocpu -Otime.
Translate uid numbers to usernames and run in logging mode, taking 10 samples at 2 second intervals.
top -ocpu -O+rsize -s 5 -n 20
Sort the processes according to CPU usage (descending) and
sOresident memory size (ascending),
update every 5 seconds , and limit to 20 processes.
top -ce # Run top in event counter mode.
top -tl 10
htop, kill, vm_stat, signal
from BSD Apple darwin 7.9.0
Each version of *nix has their own implementaition of
This document reflects Apple Mac OS X El Captian.
top [-a | -d | -e | -c mode]
[-F | -f]
[-o key] [-O ]
[-R | -r]
Periodically displays a list of system processes. The default sorting key is
Option specifications are processed from left to right. For repeated options: later specifications override earlier ones. This makes it viable to create a shell
alias for top with preferred defaults then override those preferred defaults as desired on the command line.
| Delta mode. Since previous sample. Default.
|Accumulative mode. Count events, CPU usage and time, since the launch of top.
Disables the memory object map reporting, re-enabled with
-r or the interactive
| Absolute mode. (i.e. since startup)
| Non-event mode (default). Calculate CPU usage since the previous sample.
|Calculate statistics on shared libraries, also known as frameworks (default).
| Do not "
Update framework info every |
samples ; see the PERFORMANCE vs. ACCURACY section below for more details.
logging mode and display samples samples|
Rather than redisplaying, output is periodically output in raw form.
The first sample will have an invalid
%CPU for each process, as it is calculated using the delta between samples.
| Display |
columns in logging mode.
| Only display nprocs processes.
| Order the process display by sorting on |
key in descending order.
- can be prefixed to the key name to specify ascending or descending
| Use skey as a secondary key
time Execution time.
#th threads (total/running).
#wq workqueue total/running.
prt Mach ports.
mem Internal memory (
0B zero bytes)
pgrp Process group id.
ppid Parent process id.
state running | sleeping | stuck
boosts held by the process transitions from unboosted to boosted ]
An asterisk indicates that the process was able to send boosts at some point since the previous update. See xpc_transaction_begin(3).
cpu_me CPU time charged to me by other processes.
cpu_others CPU time charged to other processes by me.
uid User ID.
faults page faults.
cow copy-on-write faults.
msgsent mach messages sent.
msgrecv mach messages received.
sysbsd BSD syscalls.
sysmach Mach syscalls.
csw context switches.
reg memory regions.
rprvt Resident private address space
vprvt Private address space
kprvt kernel Private
kshrd kernel Shared
pstate Process state.
user alias: username Username.
-o cpu -O time.
|Traverse and report the memory object map for each process (default).
| Do not ""
|Display the global statistics for swap and purgeable memory.
Set the delay between updates to |
delay seconds. Default: 1 second.
| Only display the comma separated statistics.
| Only display |
processid in top.
| Only display processes owned by user.
prio / nice is not displayed! (see
ps -o nice -o pri
The first several lines of show global state.
| Total number of processes and number of processes in each process state.
| Number of threads.
| in logging mode YYYY/MM/DD HH:MM:SS format by default.
overridden with accumulative mode. |
When running in accumulative event counting mode, the Time is in HH:MM:SS since the beginning of the top process.
| Load average over 1, 5, and 15 minutes. i.e. average number of jobs in the run queue.
| Percentage of processor usage, by user, system, and idle components. |
The time period for which these percentages are calculated depends on the event counting mode.
| Resident sizes of code and data segments, and link editor memory usage.
| Number and total size of memory regions, and total size of memory regions by private (by
non-library and library) and shared components.
| Physical memory usage, broken into wired, active, inactive, used, and free components.
| Total virtual memory, virtual memory consumed by shared libraries, and number of pageins and pageouts.
|Number and total size of input and output network packets.
| Number and total size of disk reads and writes.
|Swap usage: total size of swap areas, amount of swap space in use and amount of swap space available.
|Number of pages purged and number of pages currently purgeable.
Below the global state fields, a list of processes is displayed. The pid field displays the following for the architecture:
+ for 64-bit native or - for 32-bit native or * for a non-native .
Each command is one character, arguments are prompted for, (default shown in brackets), selected by pressing enter.
? Display the help screen.
^L Redraw the screen.
o key sorting on key A + or - prefix ascending or descending
O skey skey is secondary key
r Toggle traversal and reporting of the memory object map for each process.
S signal pid Send
The default signal starts out as
TERM. Each time a signal is successfully sent, the default signal is updated to be that
sdelay between updates
Uuser Only display processes owned by user. Either the username or uid number
To display all processes, press enter
PERFORMANCE vs. ACCURACY
Calculating detailed memory statistics is resource-intensive. To reduce the cpu usage framework stats
will be updated once every 10 samples. Specifying
-i 1 will result in the most accurate display, at the expense of
N/A - Not Available: Caused by the memory object map reporting being disabled. (default in delta mode)
, but may be enabled via
-r or the interactive
r command after any
Sort the processes according to CPU usage (descending) and resident memory size (ascending), sample and update
the display at 5 second intervals, and limit the display to 20 processes.
top -o cpu -O +rsize -s 5 -n 20
Run top in delta mode.
top -c d
Display only the specified statistics, regardless of any growth of the terminal. If the terminal is too small,
only the statistics that fit will be displayed.
top -stats pid,command,cpu,th,pstate,time