Loading...

Lab 38: Monitoring System with top

Monitor a high-load Linux system with top to identify resource pressure and the heaviest processes in real time. Sort by memory inside the UI, exit cleanly, and confirm where to find help and usage options.

troubleshooting core services

Scenario

The system is reporting high load and users are complaining about slowness. You need a real-time view of CPU, memory, and the processes contributing to the load. Your task is to use top to inspect system health, sort processes by memory usage, exit safely, and confirm how to access documentation for the tool.

Operator context

top is often the first live telemetry you grab during an incident. It helps you answer “is this CPU-bound, memory-bound, or just too many runnable tasks” before you take corrective action.

Objective

  • Launch top to view live system utilization.
  • Interpret the header sections (load, CPU, memory, swap).
  • Sort processes by memory usage inside top.
  • Exit the viewer cleanly.
  • Display help and documentation for top.

What You’ll Practice

  • Real-time system monitoring with top.
  • Reading load average, task states, CPU breakdown, memory, and swap.
  • Interactive sorting inside top using a single keypress.
  • Exiting safely (q) and locating usage help (top --help or man top).

Walkthrough

Step 1 : Launch the real-time process viewer.
Command
top

top provides a live view of system utilization and the processes consuming resources. The header gives you quick health signals like load average, task states, CPU breakdown, and memory pressure.

top - 10:15:01 up  1:23,  2 users,  load average: 0.25, 0.30, 0.28
Tasks: 150 total,   1 running, 149 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3.2 us,  1.5 sy,  0.0 ni, 94.8 id,  0.4 wa,  0.0 hi,  0.1 si,  0.0 st
MiB Mem :   7820.9 total,   2988.2 free,   1075.4 used,   3757.3 buff/cache
MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.   6366.4 avail Mem

PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
2387 alice     20   0 2412340  74200  40200 S   5.3  0.9   0:12.34 code
2194 alice     20   0 1911224  98200  53000 S   3.1  1.2   2:01.12 firefox
2381 dev       20   0 1120332  40320  14000 S   2.4  0.5   0:45.67 python3
1324 root      20   0  169084  13872   8732 S   0.3  0.2   0:04.12 systemd
1502 root      20   0  315600   8420   6020 S   0.1  0.1   0:00.98 sshd
1650 dev       20   0  987456  25400  12000 S   0.1  0.3   0:03.01 bash
Step 2 : Sort processes by memory usage inside top.
Key
M

While top is running, pressing M sorts the process list by memory usage. This helps you quickly identify memory-heavy workloads when the box feels slow due to pressure on RAM or cache behavior.

# Expected result:
# Process list reorders with highest %MEM / RES usage at the top.
Step 3 : Exit the top viewer.
Key
q

Press q to quit top cleanly and return to your shell.

# Expected result:
# top exits and you return to your prompt.
Step 4 : Display help options for the top command (outside of top).
Command
top --help
# OR
man top

Use top --help for a quick options summary or man top for the full manual. This is where you confirm keybinds, sort behavior, and flags you can use in scripts or incident runbooks.

# Expected result:
# Help output or the top manual page opens successfully.

Reference

  • top : Interactive real-time system monitor showing load, CPU, memory, and per-process usage.
  • M (inside top) : Sorts the process list by memory usage.
  • q (inside top) : Quits the viewer and returns to the shell.
  • top --help : Displays a quick summary of command-line options.
  • man top : Opens the full manual page with keybinds and behavior details.