Processes and tasks

Command top

Monitor processes and load

Linux · Bash examples · commands run on the selected server

When to use top

Use top to monitor processes and resource summaries interactively. Compare several samples before drawing conclusions: a short spike, cumulative CPU time and persistent saturation describe different conditions.

Syntax

top [PARAMETERS]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-b
Batch output instead of interactive interface.
-n N
Limit the number of updates.
-u NAME
Show user processes.

Usage examples

Open monitor

top

The interactive monitor refreshes until you quit.

Take one snapshot

top -b -n 1

One noninteractive snapshot is printed, useful for a short diagnostic capture.

Observe your processes

top -u "$USER"

The view is filtered to the current user's processes.

Notes and limitations

  • In interactive mode, q finishes browsing, P sorts by CPU, M sorts by memory into procps top.
  • The first loading interval may differ in meaning from subsequent ones; check multiple measurements.

Common questions and troubleshooting

How do I exit top?

Press q in the interactive viewer. Batch mode ends according to the configured sample count.

Why can CPU percentages exceed one hundred?

Depending on display mode and implementation, a multithreaded process can use several logical CPUs. Interpret percentages alongside CPU count and mode.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man top.