In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to check CPU and memory usage under Linux. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
Top command top command is a commonly used performance analysis tool under Linux, which can display the resource consumption of each process in the system in real time, similar to the task manager of Windows.
After running the top command, the CPU usage status is displayed in full screen and in conversation mode-with top-based commands, you can control how it is displayed, and so on. The command to exit top is Q (hit the Q key once while top is running).
Content explanation:
First line (top):
15:24:36 current time of the system
14 operating time from the startup of the days system to now
3 users the number of users currently logged in to the system, or more specifically, the number of terminals logged in to the user-the connection of the same user to multiple terminals of the system at the same time will be regarded as multiple users connected to the system, and the number of users here will also be shown as the number of terminals
The average of the current system load of load average. The last three values are the average number of processes 1 minute ago, 5 minutes ago, and 15 minutes ago, respectively. Generally speaking, when this value exceeds the number of CPU, CPU will be more laborious to load the processes contained in the current system.
The second line (Tasks):
Total number of current system processes in 288 total
1 the number of processes currently running in running
The number of processes currently waiting for sleeping
0 stoped number of system processes stopped
0 zombie number of zombie processes
The third line (Cpus):
7.3% us user space occupies CPU% 2.0% sy kernel space% CPU%% ni user process space CPU% CPU% id idle CPU% 0.3% wa percentage of CPU waiting for input and output 0.0% hi 0.0% si
0.0% st
Line 4 (Mem):
2042616 total Total physical memory 1770116 used Total physical memory used 272500 free Total Free memory 163912 buffers used as kernel cache memory
Line 5 (Swap):
Indicates that the category is the same as the fourth line (Mem), but here reflects the use of the swap partition (Swap). In general, the frequent use of swap partitions (Swap) will be seen as the result of insufficient physical memory.
2094076 total total swap area total 45052 used total swap area used 2049024 free free swap total 346624 cached buffer total swap area
The process list bar at the bottom:
The list of processes distinguished by PID will be updated periodically according to the set screen update time. You can control how it is displayed here through top internal commands:
PID: process ID USER: process owner PR: priority of the process, the smaller the priority is to be executed NInice: value VIRT: virtual memory occupied by the process RES: physical memory occupied by the process SHR: shared memory used by the process S: the status of the process. S indicates hibernation, R indicates running, Z indicates zombie, N indicates that the priority value of the process is negative% CPU: the process occupies CPU utilization% MEM: the percentage of physical memory and total memory used by the process TIME+: the total CPU time spent by the process after startup, that is, the cumulative value of CPU usage time. COMMAND: name of the process startup command
During the operation of top, the display mode of the process can be controlled by the internal commands of top. The internal commands are as follows:
S-change the screen update frequency
L-turns off or turns on the representation of top information on the first line of the first part
T-turn off or turn on the representation of the first part, the second line Tasks and the third line Cpus information
M-turns off or turns on the presentation of the first part, line 4 Mem and line 5 Swap information
N-represents the list of processes in order of PID size (later in part 3)
P-sorts the list of processes in the order of CPU occupancy (later in part 3)
M-sorts the list of processes in order of memory usage (later in part 3)
H-Show help
N-sets the number of processes displayed in the process list
Q-exit top
S-change the screen update cycle
The ps command ps command is used to report the process status of the current system. Ps command is the most basic but also very powerful process view command, which can be used to determine which processes are running and running status, whether the process ends, whether the process is dead, which processes take up too much resources, and so on. In short, most of the information can be obtained by executing the command.
F represents the flag of the program (flag), and 4 represents the user as super user
S represents the state of the program (STAT)
ID of PID program
Percentage of resources used by C CPU
PRI this is the abbreviation of Priority (priority execution order).
NI this is the Nice value.
ADDR this is kernel function, indicating which part of the program is in memory. If it is a running # program, it is usually "-"
The amount of memory used by SZ
WCHAN, is this program currently in operation? if yes, it indicates that it is in operation.
The terminal location of the TTY login
The CPU time used by TIME.
Instructions issued by CMD
The pmap command pmap command is used to report the memory mapping of a process
$pmap-d 16613
The free command free command shows the amount of memory that is not and has been used by the current system, as well as the memory buffers used by the kernel.
Here is an explanation for these numbers: total: the total amount of physical memory. Used: how much has been used. Free: how many are available? Shared: the total amount of memory shared by multiple processes. Buffers/cached: size of the disk cache.
The third line (- / + buffers/cached): used: how much has been used. Free: how many are available?
This is the end of this article on "how to check CPU and memory usage under Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.