zoukankan      html  css  js  c++  java
  • Linux 批量杀掉进程

    使用awk批量杀进程的命令:

    ps -ef | grep firefox | grep -v grep | awk '{print "kill -9 "$2}'|sh
    #列出了当前主机中运行的进程中包含firefox关键字的进程
    ps -ef | grep firefox | grep -v grep    
     
    #列出了要kill掉这些进程的命令,并将之打印在了屏幕上 
    ps -ef | grep firefox | grep -v grep | awk '{print "kill -9 "$2}'
     
    #后面加上|sh后,则执行这些命令,进而杀掉了这些进程
    ps -ef | grep firefox | grep -v grep | awk '{print "kill -9 "$2}' | sh

    使用cut批量杀进程的命令:

    ps -ef | grep firefox | grep -v grep | cut -c 9-15 | xargs kill -9
    #列出了当前主机中运行的进程中包含firefox关键字的进程
    ps -ef | grep firefox | grep -v grep 
          
    #截取第9至15字符(进程id),列出了要kill掉这些进程的id,并将之打印在了屏幕上
    ps -ef | grep firefox | grep -v grep | cut -c 9-15 
     
    #后面加上'xargs kill -9'后,则执行这些命令,进而杀掉了这些进程
    ps -ef | grep firefox | grep -v grep | cut -c 9-15 | xargs kill -9

    转载:https://www.cnblogs.com/abeen/p/11080841.html

    Talk is cheap, show me the code.
  • 相关阅读:
    SolrCloud阶段总结
    Solr总结
    机器学习算法与Python实践之(六)二分k均值聚类
    机器学习问题方法总结
    浅谈Kmeans聚类
    AVL树的算法思路整理
    Solr4.6从数据库导数据的步骤
    红黑树
    浅谈 Adaboost 算法
    POJ 1836 Alignment
  • 原文地址:https://www.cnblogs.com/cidgur/p/12029734.html
Copyright © 2011-2022 走看看