Understanding 'top' Command Output Fields in Linux
Real-Time Process Monitoring
The top program is a dynamic view of the system’s processes, displaying a summary header followed by a process or thread list similar to ‘ps’ information. Unlike the static ps output, top continuously refreshes at a configurable interval, and provides capabilities for column reordering, sorting, and highlighting. User configurations can be saved and made persistent.
Default output columns are recognizable from other resource tools:
-
The process ID (PID).
-
User name (USER) is the process owner.
-
Virtual memory (VIRT) is all memory the process is using, including the resident set, shared libraries, and any mapped or swapped memory pages. (Labeled VSZ in the ps command.)
-
Resident memory (RES) is the physical memory used by the process, including any resident shared objects. (Labeled RSS in the ps command
-
Process state (S) displays as:
- D = Uninterruptible Sleeping
- R = Running or Runnable
- S = Sleeping
- T = Stopped or Traced
- Z = Zombie
-
CPU time (TIME) is the total processing time since the process started. May be toggled to include cumulative time of all previous children.
-
The process command name (COMMAND).
Fundamental Keystrokes in top
KEY | PURPOSE |
---|---|
? Or H | Help for interactive keystrokes. |
L,T,M | Toggles for load, threads, and memory header lines. |
1 | Toggle showing individual CPUs or a summary for all CPUs in header. |
S | Change the refresh (screen) rate, in decimal seconds (e.g., 0.5, 1, 5). |
B | Toggle reverse highlighting for Running processes; default is bold only. |
B | Enables use of bold in display, in the header, and for Running processes. |
Shift+H | Toggle threads; show process summary or individual threads. |
U, Shift+U | Filter for any user name (effective, real). |
Shift+M | Sorts process listing by memory usage, in descending order. |
Shift+P | Sorts process listing by processor utilization, in descending order. |
K | Kill a process. When prompted, enter PID, then signal. |
R | Renice a process. When prompted, enter PID, then nice_value. |
Shift+W | Write (save) the current display configuration for use at the next top restart. |
Q | Quit. |