Linux kills processes that contain a keyword in bulk

Source: Internet
Author: User

Ps-ef|grep./amplxe-gui|grep-v grep|cut-c 9-15|xargs kill-9


Batch kills the process containing the keyword "./amplxe".


"Ps-ef"--View all processes


"grep ./amplxe-gui"--Lists all the processes that contain the keyword "./amplxe-gui"


"Grep-v grep"--Removes the process containing the keyword "grep" in the listed process (because the grep process we generated in the previous step also contains keywords)


"Cut-c 9-15"--intercepts the 9th character of the input line to the 15th character, which is exactly the process number PID


The "Xargs kill-9"--xargs command is used to take the output (PID) of the preceding command as a parameter to the "kill-9" command and execute the command. "Kill-9" will forcibly kill the specified process.

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.