How to stop processes that occupy 100% of the CPU in Linux

Source: Internet
Author: User

Linux is very good. It occupies low system resources and can run smoothly on low-end machines. However, it may occasionally encounter annoying problems like windows, that is, the CPU usage of processes is.
Recently, I encountered this problem. Fortunately, I used a combination of fists to kill the processes that occupy 100% of CPU resources.
Steps:
1) First, view the running status of the process, including the process ID and CPU usage. linux is still friendly. He will put the largest CPU usage at the top, and soon I will find the culprit: ID: 20641...

2) Find the process, and then take a closer look at it. Then, run PS ax to check the running status of the process. you can view the process ID, which user is using, and what process command is.
3) I understand the situation. It turns out that vi init is playing a strange role. Use kill-9 20641 to force this process to be killed.
Once again. All right, the CPU usage is back to normal.
Command syntax:
1. Top
Permission: All Users
Usage: Top [-] [d delay] [Q] [C] [s] [s] [N]
Description: displays the Process status in real time.
Parameters:
D: Change the display update speed, or press s in the interactive command Column
Q: there is no delay in display speed. if the user has the superuser permission, top will be executed in the highest priority.
C: Switch the display mode. There are two modes: one is to display only the name of the execution file, and the other is to display the complete path and name s: accumulative mode, the CPU time of the completed or deduplicated sub-itinerary (dead child process) is accumulated.
S: security mode. Cancel negotiated commands to avoid potential crisis.
I: Do not display any idle (idle) or useless (zombie) itinerary
N: number of updates. After the update is completed, the system will exit the top
B: The batch file mode, used together with the "N" parameter, can be used to output the top result to the file.
Example:
It is displayed that the system exits after 10 updates;
Top-N 10
The user will not be able to use the negotiated command to run the following commands on the itinerary:
Top-S
Input the result of the second update display to the file named top. log:
Top-N 2-B <top. Log
2. Ps
1) pS A shows all programs under the current terminal, including those of other users.
2) PS-A shows all programs.
3) when listing programs in ps c, the real command name of each program is displayed without the path, parameter or resident service identifier.
4) the effect of this parameter is the same as that of the specified "A" parameter.
5) when listing programs, PS e displays the environment variables used by each program.
6) pS F uses ASCII characters to display the tree structure and express the relationship between programs.
7) the PS-H tree structure is displayed, indicating the relationship between programs.
8) PS-n shows all programs, except the programs under the ps command terminal.
9) pS displays the program status in the program signal format.
10) when listing programs in PS, it includes interrupted subroutines.
11) PS-T <terminal number> specifies the terminal number and lists the status of programs belonging to the terminal.
12) pS U displays the program status in user-based format.
13) pS X shows all programs, which are not distinguished by terminals.
The most common method is PS-Aux. Then, a pipeline symbol is used to direct to grep to find a specific process and then operate on the specific process.

Www.linuxhao.com, a good school for Linux, provides Linux Installation Guide, Linux system management, Linux network applications, Linux server technology, Linux programming development, and Linux download center.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.