Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Shell script to realize the function of kill corresponding process according to port number

Shulou Source: shulou.com Published: 2022-06-03 09:19:24 11月15日 Update

This article introduces the knowledge of "how to use Shell script to achieve the corresponding process function according to port number kill". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The code is as follows:

Kill-9 $(lsof-iawk 22 | awk'{print $2}'| tail-n 2)

This is the end of the content of "how to use Shell script to implement the corresponding process function of kill according to port number". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Functions slogans scripts processes content more knowledge practicality learning next code dilemma reality situation articles cases editing websites industries processes Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Linux Redmi MariaDB Shulou Tech Info