During system maintenance, you may need to check the CPU usage at any time and analyze the system status based on the relevant information. In CentOS, you can use the top command to view CPU usage. After the top Command is run, the CPU usage status is displayed in full screen mode and in dialog mode. The top-based command can be used to control the display mode. The exit top Command is q. Let's take a look at the related commands below.
Linux:
Enter "top" in the command line"
You can start top
The top full-screen dialog mode can be divided into three parts: system information, command input, and process list.
Part 1-System Information bar at the top:
First line top ):
"00:11:04" indicates the current system time;
Is the current operating time after the system is started;
"2 users" is the user currently logged on to the system, more specifically, the number of terminals that log on to a user. Connections to multiple terminals in the system from the same user at the same time will be considered as the number of users connecting to the system.
The number of terminals;
"Load average" is the average value of the current system load. The following three values are the average number of processes 1 minute ago, 5 minutes ago, and 15 minutes ago, respectively, generally, when the value exceeds the number of CPUs, the CPU will be more difficult to calculate.
Processes contained in the current system;
Line 2 Tasks ):
"59 total" indicates the total number of processes in the current system;
"1 running" indicates the number of processes currently running;
"58 sleeping" indicates the number of processes in the waiting status;
"0 stoped" indicates the number of stopped system processes;
"0 zombie" indicates the number of recovered processes;
The third line Cpus ):
Indicates the current CPU usage;
Row 4 Mem ):
Total memory, current usage, idle memory, and buffer memory respectively;
Line 5 Swap ):
Indicates the usage of the switch partition Swap. In general, Swap partition Swap) is frequently used and is considered as a result of insufficient physical memory.
The second part -- Internal Command Prompt bar in the middle part:
In Linux, you can use the top internal command to control the display mode of processes. The internal commands are as follows:
-In Linux, you can view the update frequency of performance changes.
L-Disable or enable the first line of top information in the first part.
T-Disable or enable the expression of the first part of the second line of Tasks and the third line of Cpus Information
M-Disable or enable the expression of the first part of the fourth line of Mem and the fifth line of Swap information
N-in the order of PID size, the process list is listed in the third part)
P-sort the process list in the order of CPU usage. The third part is described later)
M-sort the process list in the order of memory usage. The third part is described later)
H-Show Help
N-set the number of processes displayed in the Process List
Q-exit top
S-
In Linux, view the performance change screen update cycle
Part 3-process list at the bottom:
The process list differentiated by PID is regularly updated based on the set screen update time. In Linux, you can use the top internal command to control the display mode.
- About Swap space management in Linux
- Partition Rules for swap in linux
- 2 GB virtual memory Linux swap restrictions
- In-depth exploration of Linux SNMP-Managed Devices
- There are two methods for collecting data in Linux SNMP: