Operations 7 min read

Using the Linux top Command for Real-Time System Monitoring

The Linux top command offers a dynamic, real‑time view of system processes and resource usage—showing overall statistics, CPU and memory breakdowns, and detailed process columns—while supporting customizable refresh intervals, batch mode, and interactive shortcuts for sorting, column selection, and monitoring crucial metrics like %idle, %wa, and %steal.

Java Tech Enthusiast
Java Tech Enthusiast
Java Tech Enthusiast
Using the Linux top Command for Real-Time System Monitoring

The top command provides a dynamic, real‑time view of Linux system processes and resource usage, similar to Windows Task Manager.

It displays overall system statistics in the first few lines, including current time, uptime, number of users, and load averages.

Subsequent lines show CPU usage breakdown (us, sy, ni, id, wa, hi, si, st) and memory statistics (total, free, used, buff/cache) as well as swap information.

Process information includes columns such as PID, USER, PR, NI, VIRT, RES, SHR, S, %CPU, %MEM, TIME+, and COMMAND. The default view can be customized with interactive keys.

Common top options:

top [-] [d] [p] [q] [C] [S] [s] [n]
-d
Set refresh interval (default 5 s)
-p
Show only specified process
-b -n 2 > /tmp/top.txt   Batch mode, output two iterations to a file
-S             Cumulative mode
-s             Secure mode
-i             Hide idle and zombie processes
-c             Show full command line

Interactive shortcuts allow sorting by %CPU (P), %MEM (M), TIME+ (T), changing sort order (R), selecting columns (f), swapping column order (o), and choosing sort columns (F).

CPU steal time (%st) is important for virtualized environments (e.g., EC2). A high %st indicates the VM is waiting for physical CPU resources.

Monitoring %id (idle) and %wa (I/O wait) together with %st helps assess CPU load and potential bottlenecks.

performanceOpsLinuxCPUsystem monitoringtop
Java Tech Enthusiast
Written by

Java Tech Enthusiast

Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!

0 followers
Reader feedback

How this landed with the community

login 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.