Two methods for batch process deletion in linux

Source: Internet
Author: User
Two methods for batch process deletion in linux are described. The process to kill has a common string. [Plain] kill-9 'PS-ef | grepxxx | awk & amp; #39; {print $2} & amp; #39; the symbol behind 'kill-9' is the one above the Tab key. The above is kill-9'. two methods are described to list the batch deletion processes in linux. The process to kill has a common string. [Plain] kill-9 'PS-ef | grep xxx | awk '{print $2} ''after kill-9 is the one above the Tab key. The above is kill-9' to list the processes, find the line containing xxx, and output the pid columns 'kill, ps, grep are very common commands. Awk is used to output a column. {print $2} is the second output column. the above is the pid column. Here is an awk tutorial at http://www.2cto.com/ OS /201307/230381.html. [Plain] the ps-ef | grep xxx | grep-v root | awk '{print $2}' | xargs kill-9 grep-v parameter is used to exclude a character. Therefore, the commands executed by root are excluded. Then we use awk to find the pid column. The final xargs is a program that obtains parameters from the standard output and executes the command, that is, it obtains the output from the previous command as a parameter to execute the next command.
Related Article

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.