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

    使用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 
    

      

     

  • 相关阅读:
    HUAS 1482 lsy的后宫(DP+矩阵快速幂)
    HUAS 1483 mex(离线+线段树)
    oracle 分页
    oracle 表查询(二)
    oracle 表查询(一)
    oracle 表的管理
    oracle 用户管理
    oracle sql*plus常用命令
    挑选数据库
    oracle sequence用法
  • 原文地址:https://www.cnblogs.com/abclife/p/7380397.html
Copyright © 2011-2022 走看看