Operations 12 min read

Master Linux top: Decode Output, Interactive Commands, and Advanced Options

This guide explains the Linux top command in depth, covering its default output fields, how to interpret system uptime, load averages, task summaries, CPU and memory statistics, as well as the full set of interactive keys and command‑line options for customizing monitoring.

ITPUB
ITPUB
ITPUB
Master Linux top: Decode Output, Interactive Commands, and Advanced Options

1. Top command output

The top command displays a snapshot of system activity, similar to the uptime command, followed by a list of processes with various attributes.

1.1 System uptime and load averages

Current time

System uptime

Number of logged‑in users

Load averages for the last 1, 5, and 15 minutes

Press l to toggle the load‑average display.

1.2 Task summary

The second line shows a summary of all tasks, including counts of running, sleeping, stopped, and zombie processes. Press t to toggle this view.

1.3 CPU states

The next line reports CPU usage percentages for different modes:

us – user processes

sy – kernel processes

ni – niced user processes

wa – I/O wait

hi – hardware interrupts

si – software interrupts

st – stolen time (hypervisor)

Press t to toggle the CPU view.

1.4 Memory usage

Two lines show memory statistics similar to the free command: physical memory (total, used, free, buffers) and swap space (total, used, free, buffers). Press m to toggle memory display.

1.5 Fields/columns

Below the system summary, each process is listed in columns. Important columns include:

PID – process identifier

USER – owning user

PR – scheduling priority (e.g., rt for real‑time)

NI – nice value (lower = higher priority)

VIRT – virtual memory size

RES – resident (non‑swap) memory

SHR – shared memory

S – process state (D, R, S, T, Z)

%CPU – CPU usage since last update

%MEM – physical memory usage percentage

TIME+ – total CPU time used

COMMAND – command name or full path

2. Interactive commands

2.1 h / ? – Help

Displays the interactive help screen.

2.2 Enter / Space – Refresh

Manually refreshes the display (default interval is 3 seconds).

2.3 A – Alternate display mode

Cycles through four window groups: Def (default), Job (tasks), Mem (memory), Usr (user). Use a and w to move between windows; g followed by a number selects a specific window.

2.4 B – Bold display

Toggles bold highlighting for important information.

2.5 d / s – Set refresh interval

Prompts for a new interval in seconds; entering 1 makes top refresh every second.

2.6 l , t , m – Toggle load, task, memory sections

Shows or hides the corresponding summary rows.

2.7 f – Field management

Enters a screen to select which columns are displayed; * marks selected fields. Arrow keys navigate, < and > move fields left/right, Enter confirms.

2.8 R – Reverse sort

Switches between normal and reverse ordering.

2.9 c – Toggle command/path display

Shows either the command name or the full executable path.

2.10 i – Idle tasks

Shows or hides idle (sleeping) processes.

2.11 V – Tree view

Displays processes in a hierarchical tree.

2.12 Z – Change colors

Opens a screen to assign colors to the eight task windows.

2.13 z – Toggle color mode

Turns colored output on or off.

2.14 x / y – Highlight

x

highlights the sorted column; y highlights the running process row (requires color mode).

2.15 u – Filter by user

Prompts for a username; leaving it blank shows all users.

2.16 n / # – Set maximum tasks

Limits the number of processes displayed.

2.17 k – Kill task

Sends a signal (default SIGTERM) to a selected process.

2.18 r – Renice

Changes the scheduling priority of a process.

3. Command‑line options

3.1 -b – Batch mode

Runs top in non‑interactive batch mode, suitable for redirecting output to a file.

3.2 -c – Command name toggle

Starts with the last remembered setting for showing full command paths.

3.3 -d – Delay interval

Sets the refresh delay in seconds, e.g., top -d 1 refreshes every second.

3.4 -i – Toggle idle processes

Inverts the previous i state.

3.5 -n – Iteration count

Specifies how many updates to perform before exiting, e.g., top -n 3.

3.6 -p – Monitor specific PID

Limits monitoring to the given PID (0 monitors top itself).

3.7 -u / -U – User filter

Shows processes belonging to a specific username or UID. These options are mutually exclusive with -p and each other; combining them results in a “conflicting process selections” error.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

process managementLinuxcommand-linesystem-monitoringtop
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.