In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about how to find processes with high CPU usage in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1) how to use the top command to find out the processes with high CPU consumption in Linux
Of all the tools that monitor the performance of Linux systems, Linux's top command is the best and best known. The top command provides a dynamic real-time view of the processes running on the Linux system. It can display an overview of the system and a list of processes currently managed by the Linux kernel. It shows a lot of system information, such as CPU usage, memory usage, swapping memory, number of processes running, current system boot time, system load, buffer size, cache size, process PID, and so on. By default, the output of the top command is sorted by CPU usage, and the results are updated every 5 seconds. If you want a clearer view to analyze the results more deeply, running the top command in batch mode is the best way. At the same time, you need to understand the meaning of the output of the top command in order to solve the system performance problems.
# top-b | head-50 top-00:19:17 up 14:23, 1 user, load average: 2.46,2.18, 1.97Tasks: 306 total, 1 running, 305 sleeping, 0 stopped, 0 zombie%Cpu0: 10.4 us, 3.0 sy, 0.0 ni, 83.9 id, 0.0 wa, 1.3 hi, 1.3 si, 0.0 st%Cpu1: 17.0 us, 3.0 sy, 0.0 ni, 78.7 id 0.0 wa, 0.3 hi, 1.0 si, 0.0 st%Cpu2: 13.0 us, 4.0 sy, 0.0 ni, 81.3 id, 0.0 wa, 0.3 hi, 1.3 si, 0.0 st%Cpu3: 12.3 us, 3.3 sy, 0.0 ni, 82.5 id, 0.3 wa, 0.7 hi, 1.0 si, 0.0 st%Cpu4: 12.2 us 3.0 sy, 0.0 ni, 82.8 id, 0.7 wa, 0.3 hi, 1.0 si, 0.0 st%Cpu5: 6.4 us, 2.7 sy, 0.0 ni, 89.2 id, 0.0 wa, 0.7 hi, 1.0 si, 0.0 st%Cpu6: 26.7 us, 3.4 sy, 0.0 ni, 68.6 id, 0.0 wa, 0.7 hi 0.7 si, 0.0 st%Cpu7: 15.6 us, 4.0 sy, 0.0 ni, 78.8 id, 0.0 wa, 0.7 hi, 1.0 si, 0.0 stKiB Mem: 16248556 total, 1448920 free, 8571484 used, 6228152 buff/cacheKiB Swap: 17873388 total, 17873388 free, 0 used. 4596044 avail MemPID USER PR NI VIRT RES SHR S% CPU% MEM TIME+ COMMAND 2179 daygeek 20 3106324 613584 327564 S 79.5 3.8 14purl 19.76 Web Content 1714 daygeek 20 4603372 974600 403504 S 20.2 65 daygeek 18.91 firefox 1227 daygeek 20 192012 376332 180348 S 13.9 2.3 20 MEM TIME+ COMMAND 43.26 gnome-shell18324 daygeek 20 3296192 766040 127948 S 6.3 94.7 94.7 Web Content 1170 daygeek 20 1008264 572036 546180 S 6.0 3.5 18 Xorg 4684 daygeek 20 3363708 1.1g S 3.67.2 13MU 49.92 VirtualBoxVM 4607 daygeek 20 4591040 1.7g S 3.011.014daygeek 09.65 VirtualBoxVM 1211 daygeek 9-11 2865268 21032 16588 S 2.0 100.37 pulseaudio 4562 daygeek 20 106828812 21044 S 1.7 0.2 4:42.93 VBoxSVC 1783 daygeek 20 3123888 376896 134788 S 1.3 2.3 39:32.56 Web Content 3286 daygeek 20 3089736 404088 184968 S 1.0 2.5 41:57.44 Web Content
The various parts of the above command explain:
Top: command
-b: batch file mode
Head-50: displays the top 50 output results
PID: the ID of the process
USER: the owner of the process
PR: the level of the process
NI: the NICE value of the process
VIRT: virtual memory used by the process
RES: the physical memory used by the process
SHR: shared memory used by the process
S: this value indicates the state of the process: s = sleep, R = run, Z = zombie process
% CPU: percentage of CPU occupied by the process
% MEM: percentage of RAM used by the process
How long did the TIME+: process run
COMMAND: process name
If you want to see the full path to the command instead of the command name, run the top command in the following format:
# top-c-b | head-50 top-00:28:49 up 14:33, 1 user, load average: 2.43,2.49, 2.23Tasks: 305 total, 1 running, 304 sleeping, 0 stopped, 0 zombie%Cpu0: 11.7 us, 3.7 sy, 0.0 ni, 82.3 id, 0.0 wa, 1.0 hi, 1.3 si, 0.0 st%Cpu1: 13.6 us, 3.3 sy, 0.0 ni 81.1 id, 0.7 wa, 0.3 hi, 1.0 si, 0.0 st%Cpu2: 10.9 us, 2.6 sy, 0.0 ni, 85.1 id, 0.0 wa, 0.3 hi, 1.0 si, 0.0 st%Cpu3: 16.0 us, 2.6 sy, 0.0 ni, 80.1 id, 0.0 wa, 0.3 hi, 1.0 si 0.0 st%Cpu4: 9.2 us, 3.6 sy, 0.0 ni, 85.9 id, 0.0 wa, 0.3 hi, 1.0 si, 0.0 st%Cpu5: 15.6 us, 2.9 sy, 0.0 ni, 80.5 id, 0.0 wa, 0.3 hi, 0.7 si, 0.0 st%Cpu6: 11.6 us, 4.3 sy, 0.0 ni, 82.7 id 0.0 wa, 0.3 hi, 1.0 si, 0.0 st%Cpu7: 8.0 us, 3.0 sy, 0.0 ni, 87.3 id, 0.0 wa, 0.7 hi, 1.0 si, 0.0 stKiB Mem: 16248556 total, 1022456 free, 8778508 used, 6447592 buff/cacheKiB Swap: 17873388 total, 17873388 free, 0 used. 4201560 avail MemPID USER PR NI VIRT RES SHR S% CPU% MEM TIME+ COMMAND18527 daygeek 20 3151820 624808 325748 S 52.8 3.8 59V 26.72 / usr/lib/firefox/firefox-contentproc-childID 18-isForBrowser-prefsLen 10002-prefMapSize 213431-parentBuildID 20191031132559-greomni / + 1714 daygeek 20 4764668 910940 443228 S 21.55.6 68V 59.33 / usr/lib/firefox/firefox-new-window 1227 daygeek 20 419108 377344 181404 S 11 .6 2.3 21 daygeek 47.36 / usr/bin/gnome-shell 1170 daygeek 20 1008820 572700 546844 S 5.6 3.5 19V 05.10 / usr/lib/Xorg vt2-displayfd 3-auth / run/user/1000/gdm/Xauthority-nolisten tcp-background none-noreset-keeptty-verbose 318324 daygeek 20 3300288 789344 127948 S 5.04.9 9displayfd / usr/lib/firefox/firefox-contentproc-childID 16-isForBrowser-prefsLen 10002-prefMapSize 213431-parentBuildID 20191031132559-greomni / + 4684 daygeek 20 3363708 1.1g S 3.6g S 3.6 7.214daygeek 10.18 / usr/lib/virtualbox/VirtualBoxVM-- comment CentOS7-- startvm 002f47b8-2af2-48f5-be1d-67b67e03514c-- no-startvm-errormsgbox 4607 daygeek 20 4591040 1.7g S 3.011.014VR 28.86 / usr/lib/virtualbox/VirtualBoxVM-comment Ubuntu-18.04-- startvm e8c32dbb-8b01-41b0 -- 977a-bf28b9db1117-- no-startvm-errormsgbox 1783 daygeek 20 3132640 451924 132168 S 2.6 2.8 39Ru 49.66 / usr/lib/firefox/firefox-contentproc-childID 1-isForBrowser-prefsLen 1-prefMapSize 213431-parentBuildID 20191031132559-greomni / usr/l+ 1211 daygeek 9-11 2865268 21272 16828 S 2.0 0.1 11V 01.29 / usr/bin/pulseaudio-- daemonize=no 4562 daygeek 20 106888 28812 21044 S 1.70.2 4 49.33 / usr/lib/virtualbox/VBoxSVC-- auto-shutdown16865 daygeek 20 3073364 430596 124652 S 1.3 2.7 8 usr/lib/firefox/firefox 04.02 / usr/lib/firefox/firefox-contentproc-childID 15-isForBrowser-prefsLen 10002-prefMapSize 213431-parentBuildID 20191031132559-greomni / + 2179 daygeek 20 2945348 429644 172940 S 1.0 2.6 15Rich 20.90 / usr/lib/firefox/firefox-contentproc-childID 6-isForBrowser-prefsLen 7821-prefMapSize 213431-parentBuildID 20191031132559-greomni / us+2) how to make Use the ps command to find out the processes with high CPU consumption in Linux
Ps is an acronym for process status process status, which displays information about active / running processes in the system. It provides a snapshot of the current process and its details, such as user name, user ID, CPU usage, memory usage, process startup date and time, command name, and so on.
# ps-eo pid,ppid,%mem,%cpu Cmd-- sort=-%cpu | head PID PPID% MEM% CPU CMD18527 1714 4.2 40.3 / usr/lib/firefox/firefox-contentproc-childID 18-isForBrowser-prefsLen 10002-prefMapSize 213431-parentBuildID 20191031132559-greomni / usr/lib/firefox/omni.ja-appomni / usr/lib/firefox/browser/omni.ja-appdir / usr/lib/firefox/browser 1714 true tab 1714 1152 5.68.0 / usr/lib/firefox/firefox-new-window18324 1714 4.9 6.3 / usr/lib/ Firefox/firefox-contentproc-childID 16-isForBrowser-prefsLen 10002-prefMapSize 213431-parentBuildID 20191031132559-greomni / usr/lib/firefox/omni.ja-appomni / usr/lib/firefox/browser/omni.ja-appdir / usr/lib/firefox/browser 1714 true tab 3286 1714 2.5.1 / usr/lib/firefox/firefox-contentproc-childID 14-isForBrowser-prefsLen 8078-prefMapSize 213431-parentBuildID 20191031132559-greomni / usr/lib/firefox/omni.ja-appomni / usr/lib/firefox/browser/omni.ja-appdir / usr / lib/firefox/browser 1714 true tab 1783 1714 3.04.5 / usr/lib/firefox/firefox-contentproc-childID 1-isForBrowser-prefsLen 1-prefMapSize 213431-parentBuildID 20191031132559-greomni / usr/lib/firefox/omni.ja-appomni / usr/lib/firefox/browser/omni.ja-appdir / usr/lib/firefox/browser 1714 true tab 1227 1152 2.3 2.5 / usr/bin/gnome-shell 1170 1168 3.5 2.2 / usr/lib/Xorg vt2-displayfd 3-auth / run/user / 1000/gdm/Xauthority-nolisten tcp-background none-noreset-keeptty-verbose 316865 1714 2.1 / usr/lib/firefox/firefox-contentproc-childID 15-isForBrowser-prefsLen 10002-prefMapSize 213431-parentBuildID 20191031132559-greomni / usr/lib/firefox/omni.ja-appomni / usr/lib/firefox/browser/omni.ja-appdir / usr/lib/firefox/browser 1714 true tab 2179 1714 2.71.8 / usr/lib/firefox/firefox-contentproc-childID 6-isForBrowser-prefsLen 7821-prefMapSize 213431-parentBuildID 20191031132559-greomni / usr/lib/firefox/omni.ja-appomni / usr/lib/firefox/browser/omni.ja-appdir / usr/lib/firefox/browser 1714 true tab
The various parts of the above command explain:
Ps: command name
-e: select all processes
-o: custom output format
-sort=-%cpu: sorts the output based on CPU usage
Head: displays the first 10 lines of the result
PID: the ID of the process
PPID: ID of the parent process
% MEM: percentage of RAM used by the process
% CPU: percentage of CPU occupied by the process
Command: process name
If you want to see only the name of the command instead of the absolute path of the command, run the following format ps command:
# ps-eo pid,ppid,%mem,%cpu,comm-- sort=-%cpu | head PID PPID% MEM% CPU COMMAND18527 1714 4.1 40.4 Web Content 1714 1152 5.7.8.0 firefox18324 1714 4.9 6.3 Web Content 3286 1714 2.5.1 Web Content 1783 1714 3.4.5 Web Content 1227 1152 2.3 2.5 gnome-shell 1170 1168 3.5 2.2 Xorg16865 1714 2.1 Web Content 2179 1714 2.7 1.8 Web Content thank you for reading! This is the end of this article on "how to find out the process with high CPU occupation in Linux". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, you can 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.