top

Live view of CPU and memory with the busiest processes

top Processes and system GPL-2.0-or-later

About

top refreshes a full-screen table every couple of seconds, showing overall load and the processes using the most processor time. Present on nearly every Unix-like system, it is the reliable choice when nothing fancier is installed. Watch it to catch a runaway task as it happens.

Install it

pkg install procps

Run this inside Termux. If the package is already present, pkg will say so and do nothing.

Commands worth knowing

6 of the invocations you will actually reach for. Tap the copy button to put one on your clipboard.

top Open the live monitor with a default refresh interval. Shows a summary of load, memory and the busiest tasks.
top -d 1 Refresh once a second instead of every few. Short spikes become easier to catch.
top -b -n 1 Print a single snapshot in plain text and exit. The right choice when saving output to a file.
top -o %MEM Order the task list by memory use rather than processor time.
top -p 4321 Restrict the view to a single process identifier. Watch one task without noise.
top -u u0_a123 Show only the processes owned by one user. Keeps the list short on a busy system.

Worked example

Run top -b -n 1 and this is what you should see.

termux
$ top -b -n 1
Tasks: 187 total,   1 running, 186 sleeping
Mem:   3721M total,  2103M used,  1618M free
Swap:  1024M total,   120M used,   904M free
  PID USER      %CPU %MEM COMMAND
 4321 u0_a123   12.5  2.3 com.termux

Developed by

procps-ng project · released under GPL-2.0-or-later.