Bsd top

From wikinotes

BSD variant of the top program to see live system resource usage.
See also gnu top.

Configuration

Environment

$TOP the default params passed to top on startup

Usage

Commandline

top -w -o swap  # top sorted by swap usage
top -o cpu      # top sorted by cpu
top -o res      # top sorted by used memory

top -o res -a | less -S # top sorted by used mem, showing cli params for prog

Interactive

Top also has some useful hotkeys

h     # show help
m     # toggle between CPU/IO views (different info)
o     # sort by a column of your choosing
w     # toggle display of swap
P     # toggle per-cpu stats

Columns

Some key columns, and their descriptions.

# NOTE: for virtual memory info, use `ps -v` and look at `VSX`
SIZE  # (kb) size of process (text, data, stack -- NOT HEAP)
RES   # (kb) resident memory (consumed RAM)
SWAP  # (kb) swapped memory

Notes

ACTIVE/WIRED  # memory that cannot be converted to free memory
INACTIVE      # memory owned by a process, but can be converted to free memory
FREE          # actual free memory