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
    
  • 相关阅读:
    smarty
    js进阶
    JS 基础
    php之面向对象(2)
    php之面向对象(1)
    PHP之图形处理
    PHP代码分离
    PHP文件上传与安全
    PHP substr截取中文字符出现乱码的问题解疑
    关于学习方法
  • 原文地址:https://www.cnblogs.com/abeen/p/11080841.html
Copyright © 2011-2022 走看看