Operations 4 min read

Understanding the Linux top Command: Options, Output Fields, and Interactive Controls

This article explains how the Linux top command provides real‑time server monitoring, details its common options, interprets each line of its output—including CPU, memory, and process information—and shows useful interactive commands and a practical example for tracking a specific process.

php中文网 Courses
php中文网 Courses
php中文网 Courses
Understanding the Linux top Command: Options, Output Fields, and Interactive Controls

The top command in Linux offers real‑time monitoring of server health and is one of the most valuable tools for operations engineers.

Unlike ps , which captures a snapshot of processes at a single moment, top continuously updates the display, allowing ongoing observation of system activity.

Basic usage is top [options] . Common options include:

-d : screen refresh interval (default 5 seconds)

-n : number of refreshes

-u : filter by username

-p : filter by process ID

The first line of the output shows the current time, system uptime, number of logged‑in users, and load average for the past 1, 5, and 15 minutes, indicating how many processes are competing for CPU resources.

The second line summarizes the total number of processes, how many are running, sleeping, etc.

The third line reports CPU usage percentages:

us – user‑space CPU usage

sy – kernel‑space CPU usage

id – idle CPU percentage

wa – I/O wait percentage

The fourth and fifth lines display memory and swap usage respectively.

Top also provides interactive commands that can be triggered while it is running; the most useful are:

P – sort processes by CPU usage

M – sort processes by resident memory size

c – toggle between command name and full command line

For a practical scenario, if a MySQL process (PID 1992) is consuming excessive resources, you can monitor it directly with:

top -p 1992

This focused view helps identify whether the process continues to consume resources over time, enabling timely corrective actions.

performanceclioperationsLinuxserver monitoringtop command
php中文网 Courses
Written by

php中文网 Courses

php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.

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.