next up previous
Next: Memory Management Up: Introduction to the Linux Previous: Finding out what's running:

Finding out what's running: : top

By default the top command shows the processes that are taking up most of the computer's time.

top - 16:05:14 up 13 days,  6:35,  4 users,  load average: 0.07, 0.04, 0.02
Tasks: 107 total,   1 running, 106 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7% us,  0.1% sy,  0.1% ni, 98.8% id,  0.2% wa,  0.0% hi,  0.0% si
Mem:    255608k total,   243632k used,    11976k free,    10276k buffers
Swap:   522072k total,    59284k used,   462788k free,   102412k cached

  PID USER      PR  NI  VIRT  RES  SHR S \%CPU \%MEM    TIME+  COMMAND
    1 root      16   0  1740  500  472 S  0.0  0.2   0:00.67 init
    2 root      34  19     0    0    0 S  0.0  0.0   0:00.01 ksoftirqd/0
    3 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
    4 root      10  -5     0    0    0 S  0.0  0.0   0:03.05 events/0
    5 root      19  -5     0    0    0 S  0.0  0.0   0:00.01 khelper
    6 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 kthread
   10 root      10  -5     0    0    0 S  0.0  0.0   0:00.46 kblockd/0
   11 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 kacpid
  252 root      20  -5     0    0    0 S  0.0  0.0   0:00.00 khubd
  256 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kseriod
  313 root      15   0     0    0    0 S  0.0  0.0   0:00.18 pdflush
  314 root      15   0     0    0    0 S  0.0  0.0   0:00.11 pdflush

The first few lines tell you useful information about the machine. These include: the current time, how long the computer has been running for, how many users are using the machine, what the load average has been (more later), how many tasks are active at the moment (and how many are actually running), how much of the CPU's time is being used, how much RAM the computer has, how much is being used, and how much is still available.

After the first few lines texttttop has a list of processes and various pieces of information about them. Probably the most important things for now are the PID (first column), who's running the process (second column), what percentage of the machine's CPU time and memory it's using (9th and 10th columns), how long it's been running for (11th column) and what the process is called (last column).

Pressing `M' causes top to display the top processes in terms of memory usage, rather than CPU time. You can return to CPU time by pressing `T', and `q' quits.


next up previous
Next: Memory Management Up: Introduction to the Linux Previous: Finding out what's running:
Phil Hasnip 2007-08-23