Back to the command reference

top

ProcessesBeginner In real Linux

Live view of processes and resource usage

Name: top: shows the top resource consumers

This command needs a real Linux system; you can practise it in real Linux mode.

Description

top shows a live system summary and process list, refreshing every 3 seconds. The header has uptime, load averages, task counts and CPU and memory usage; the list below is sorted by CPU use.

It is interactive: P sorts by CPU, M by memory, k kills a process, 1 shows each core, q quits.

Syntax

top [OPTION]...

Common options

-u USEROnly a user's processes
-p PIDWatch only these processes
-d SECONDSRefresh interval (3 seconds by default)
-o FIELDSort by a column, e.g. -o %MEM
-bBatch mode: plain text you can redirect (with -n)
-n NUMQuit after NUM refreshes
P / M(inside top) Sort by CPU / memory
1Show each CPU
cShow the full command line
k(inside top) Kill a process
qQuit

Examples

  • $ top

    See which processes use the most resources

    Explain
  • $ top -u www-data

    Only processes of www-data

    Explain

Related