Page Body

Real-Time System Process Management With top

You can view a constant real-time update of running processes on a GNU/Linux system with the top command.

Note: If you are not familiar with the GNU/Linux command line interface, review the Conventions page before proceeding.

top Output

top is an interactive program and its output is dense, so it is helpful to break down the information it displays, line-by-line.

Line One

Line One

The first line of top's output tells you:

  • How long the system has been up
  • How many users are logged in
  • What the load average is

Essentially, this information is equivalent to the output of the uptime command.

Line Two

Line Two

The second line of top's output tells you the:

  • Total number of processes
  • Number of running processes
  • Number of sleeping processes
  • Number of stopped processes
  • Number of zombie processes

Running processes are those that are either running on the CPU or waiting to run on the CPU (i.e., those in the run queue).

Sleeping processes are those that are waiting for something to happen before continuing to resume (i.e., those in a wait queue). At any given time, most processes are in a sleep state.

Stopped processes are those that have been sent a SIGTSTP/SIGSTOP signal.

Zombie processes are child processes that have completed, but whose parent process has not inquired about their state (i.e., successfully picked up the child process's exit status). These processes have no impact on the system, except for a gratuitous entry in the system process table.

Line Three

Line Three

The third line of top's output tells you the:

  • Percentage of CPU time used running user processes (us) and system processes (sy)
  • Percentage of CPU time used running niced user processes (ni), i.e., low priority processes
  • Percentage of CPU time spent in the kernel idle handler (id)
  • Percentage of CPU spent waiting (wa) for I/O completion
  • Percentage of CPU spent servicing hardware (hi) versus software interrupts (si)
  • Percentage of time that a virtual CPU waits for a real CPU while the hypervisor is servicing another virtual processor (steal time, st)

Line Four

Line Four

The fourth line of top's output tells you the:

  • Total physical memory, free physical memory, used physical memory, and buff/cache (i.e., the sum of the memory used by the kernel buffers and the page cache/slabs)

Line Five

Line Five

The fifth line of top's output tells you the:

  • Total swap memory, free swap memory, used swap memory, and available memory (i.e., an estimation of how much memory is available for starting new applications, without swapping)

The information in lines four and five is comparable to the output of the free command.



The rest of top's output displays columnar data regarding the running processes on your system. The columns are:

The Process ID.
The User Owner of the process.
The Priority Value of the process. This is the real priority value for a process at the moment inside of the kernel.
The Nice Value of the process. This value represents a suggestion for the kernel about the priority a process should have.
The total amount of virtual memory used by the process. Expressed in KiB (kibibytes).
The subset of virtual address space (i.e., VIRT) representing the physical memory a process is currently using. Expressed in KiB (kibibytes).
The subset of resident memory (i.e., RES) that may be used by other processes. Expressed in KiB (kibibytes).
The process status.
A process's share of the elapsed CPU time since the last screen update, expressed as a percentage of total CPU time.
A process's current resident share of available physical memory.
The total CPU time the process has used since it started through hundredths of a second.
The command name or command line associated with the process.

Keyboard Shortcuts

There are a variety of keyboard shortcuts you can use to either change the output of top or to interact with running processes.

Clear filters.
Show command full paths.
Fields Management. Press Escape to exit.
Switch to thread view (press again to switch back to process view).
Show idle/zombie processes.
Kill process. You will need to enter a PID and can enter an optional signal (SIGTERM is used by default).
Toggle between memory views.
Sort by memory usage.
Prompt for the number of processes to display.
Sort by PID.
Filter processes (e.g., COMMAND=getty, !COMMAND=getty, %CPU>3.0).
Sort by CPU usage.
Prompt for PID to affect and provide new nice number value.
Quit top.
Sort by ascending order.
Toggle between CPU views.
Sort by execution time.
Switch to processes for specific user (leave user blank to switch back to all users).
Switch to forest view.
Save changes to top's output.


For more on top, you can run the man 1 top command to view its manual page. Alternatively, you can view its manual page online.

Enjoyed this post?

Subscribe to the feed for the latest updates.