Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to batch Kill multiple processes in Linux

2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to batch Kill multiple processes in Linux, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Ps-ef | grep LOCAL=NO | grep-v grep | cut-c 9-15 | xargs kill-9

The pipe character "|" is used to separate two commands, and the output of the command on the left side of the pipe character is used as the input of the command on the right side of the pipe character. Let's talk about the connection with pipe characters.

Several commands:

"ps-ef" is a command in Red Hat to view all processes. The retrieved process will be used as input to the next command "grep LOCAL=NO".

The output of "grep LOCAL=NO" is all processes with the keyword "LOCAL=NO", which is a common feature of remote connection processes in the Oracle database.

"grep-v grep" is a process that removes the keyword "grep" from the listed processes.

"cut-c 9-15" intercepts the 9th to 15th characters of the input line, and this happens to be the process number PID.

The xargs command in "xargs kill-9" is used to take the output of the previous command (PID) as an argument to the "kill-9" command and execute the command.

"kill-9" forcibly kills the specified process, thus successfully purging all remotely connected processes from oracle. For other similar tasks, you only need to modify the keyword part of "grep LOCAL=NO".

Ps-ef | grep / usr/local/apache-tomcat-document/ | grep-v grep | cut-c 9-15 | xargs kill-9

The above is how to batch Kill multiple processes in Linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report