linux - kill -9 command to kill multiple threads

background introduction

For some application scenarios, if you want to kill multiple threads, if the idea is too stuck, you want to list all java-related processes, and then use kill -9 to kill them one by one, so that the server or local mac notebook will not be stuck, but this is relatively slow. After all, you need to input thread ids one by one.

demo@B-admin-2054 ~ % jps
1526 RemoteMavenServer
1513 RemoteMavenServer36
1561 RemoteMavenServer
1595 RemoteMavenServer36
1631 Jps

demo@B-admin-2054 ~ % kill -9 1526
demo@B-admin-2054 ~ % kill -9 1513
jps : list all java related processes
kill -9 : kill thread.

Solution

Just put the thread id in the back once.
kill -9 1526 1513 1561 1595
This is the end of this article about how to kill multiple processes at one time with the linux-kill command. I hope the author's answer will be helpful to everyone.

advanced use

Step1

You can first use the ps -ef command to get the thread id of the relevant activity

Step2

Then use pipeline commands to capture related tasks such as:
ps -ef |grep java View active processes containing "java"
ps -ef |grep -v java View active processes without java

Step3

Then use the above command to kill the object thread id.

Guess you like

Origin blog.csdn.net/qq_39463175/article/details/130876914