Top commands are commonly used in Linux and are a good tool for checking the system running status.
The top command reveals the system running status in many aspects. Understanding the meaning of the top command is helpful for troubleshooting.
Row 1: Overall Operation overview
10:40:38 --- current time
Up 108 days, --- server running time
1 user --- current Login User count
Load average: 0.06, 0.01, 0.00 --- average system load (average length of task queue), average load from 1 minute, 5 minutes, 15 minutes to the present
Row 2: Process Overview
520 total --- total process count
1 running --- Number of Running Processes
519 sleeping --- Number of sleeping Processes
0 stopped --- Number of stopped Processes
0 zombie --- Number of zombie Processes
Row 3: CPU Overview
0.1% us --- CPU time of the user process
0.2% Sy --- CPU time of the system process
2.3% Ni --- CPU time of a process that has changed its priority
97.3% ID --- idle CPU time
0.0% wa --- wait for input/output CPU time
0.0% Hi --- hardware interrupt CPU time
0.0% Si --- CPU interruption time of software
0.0% st ---???
Row 4: Memory Overview
7680000 k total --- total memory
7661668 K used --- memory in use
18332 K free --- idle memory
345776 K buffers --- memory used as the kernel Cache
Row 5: swap Overview
2096472 k total --- swap space size
88 K used --- swap space usage
2096384 K free --- unused swap space
2527768 K cached --- swap space buffered by memory
Row 6: column name
PID: process ID
User: the user who runs the process
PR: Process Priority
Ni: Nice value of the process. negative value indicates a higher priority. positive value indicates a lower priority. 0 indicates that the priority has not changed.
Virt: virtual memory size used by the Process
Res: Non-swap physical memory size used by the Process
SHR: the size of the shared memory used by the process.
S: Process status, D (sleep that cannot be interrupted), R (running), S (sleeping), T (traced or stopped), Z (zombie process)
% CPU: the percentage of CPU used by the process, which is the sum of the percentage used by all CPU cores and may exceed 100%.
% Mem: Percentage of physical memory used by the Process
Time +: CPU time used by the process, 1/100 seconds
Command: process command
Values to be followed:
(1) Load average: This value reflects the average length of the task queue. If this value exceeds the number of CPUs, the current number of CPUs is insufficient to process the task and the load is too high.
(2) % us: CPU time percentage of the user. If this value is too high, it may be an endless loop in the code or frequent GC.
(3) % Sy: Percentage of system CPU time. If this value is too high, it may be due to fierce competition of system threads and excessive context switching. The number of threads should be reduced.
(4) % Wa: Percentage of CPU time waiting for input and output. If this value is too high, it indicates that the system Io speed is too slow and the CPU is mostly waiting for Io completion.
(5) % Hi: Percentage of CPU interrupted by hardware; when the hardware is interrupted, the CPU takes precedence over hardware interruption. For example, when the NIC receives data, hardware interruption occurs.
(6) Swap used: used swap. A high value indicates frequent swap-in and swap-out operations due to insufficient memory. This will affect the efficiency and increase the memory size.
(7) % CPU: Percentage of CPU used by the process. A high value indicates that the CPU is performing non-blocking operations.
Common options:
-H: Display in thread mode
-B: displayed in batches
-C: displays the command line or program name.
-D: Update Interval
-N: number of iterations
-P: monitors some PID processes.
After the command line is started, you can use some shortcut commands
(1) h: Display in thread mode
(2) h: Help
(3) c: display the command line or program name
(4) Q: Quit
(5) F: add or remove a domain
(6) O: Change the domain display
(7) f or O: select the sorting Field
(6) R: Reverse Order
More commands: