Skip to content

top command

Watch processes and CPU and memory use live.

On this page

Syntax

top [options]

Provided by the procps package. Run man top for the full manual.

Common options

OptionWhat it does
-u USEROnly that user's processes
-p PIDOnly these process IDs
-d NRefresh every N seconds
-bBatch mode for scripts
-n NStop after N refreshes

Examples

  1. Start top

    top
  2. Only one user's processes

    top -u www-data
  3. Watch one process

    top -p 1234
  4. One snapshot for a script

    top -b -n 1 | head -20
  5. Refresh every 5 seconds

    top -d 5

Tips

  • Inside top: P sorts by CPU, M by memory, k kills a process, 1 shows each CPU, q quits.

top guides

← All Linux commands · Suggest a fix

Back to top