Name

top — stdin  stdout  - file  -- opt  --help  --version

Synopsis

top [options]

The top command lets you monitor the most active processes, updating the display at regular intervals (say, every second). If your Mac seems slow, top will tell you which process, if any, is to blame. It is a screen-based program that updates the display in place, interactively. top first displays general system information about CPU and memory usage:

top
Processes: 81 total, 2 running, 1 stuck, 78 sleeping, ...
2012/03/12 22:28:03
Load Avg: 0.36, 0.43, 0.48 
CPU usage: 8.10% user, 21.62% sys, 70.27% idle 
SharedLibs: 632K resident, 0B data, 0B linkedit.
MemRegions: 48380 total, 1582M resident, 29M private, ...
PhysMem: 891M wired, 2095M active, 770M inactive, ...
VM: 189G vsize, 1091M framework vsize, 21497(0) pageins, ...
Networks: packets: 53842/12M in, 63096/41M out.
Disks: 4550433/439G read, 985283/54G written.

and follows it with a list of running processes:

PID    COMMAND      %CPU TIME     ... RPRVT  RSHRD  RSIZE
42652  top          8.8  00:00.89 ... 1392K  216K   2108K
42206  sshd         0.0  00:00.05 ...  456K   1632K  3036K
41202  Address Book 0.0  00:01.41 ...   13M    13M    22M
39720- Microsoft Wo 0.6  05:38.03 ...  409M   55M    670M
...

While top is running, you can press keys to change its behavior interactively, such as setting the update speed (s) or sorting by a particular column (o). Type ? to see a complete list and q to quit.

Useful options

-l N

Perform N updates, then quit.

The command top -l1 > outfile saves a quick snapshot to a file.

-s

Get Macintosh Terminal Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.