• 杀掉多线程id


    root@90df9d7f9946:/home/abc-pytorch-v2# ps -ef
    UID        PID  PPID  C STIME TTY          TIME CMD
    root         1     0  0 Jul27 pts/0    00:00:00 bash
    root        16     0  0 Jul27 pts/1    00:00:00 bash
    root      3824     0  0 Jul27 pts/2    00:00:00 bash
    root     21278  3824 19 11:36 pts/2    00:00:16 python main.py
    root     21314 21278 87 11:36 pts/2    00:01:13 python main.py
    root     21330 21278 88 11:36 pts/2    00:01:14 python main.py
    root     21346 21278 87 11:36 pts/2    00:01:13 python main.py
    root     21347 21278 86 11:36 pts/2    00:01:12 python main.py
    root     21378 21278 87 11:36 pts/2    00:01:13 python main.py
    root     21394 21278 87 11:36 pts/2    00:01:13 python main.py
    root     21410 21278 88 11:36 pts/2    00:01:14 python main.py
    root     21426 21278 88 11:36 pts/2    00:01:14 python main.py
    root     21427 21278 86 11:36 pts/2    00:01:12 python main.py
    root     21428 21278 87 11:36 pts/2    00:01:13 python main.py
    root     21429 21278 87 11:36 pts/2    00:01:13 python main.py
    root     21460 21278 87 11:36 pts/2    00:01:13 python main.py
    root     21491 21278 87 11:36 pts/2    00:01:13 python main.py
    root     21522 21278 87 11:36 pts/2    00:01:13 python main.py
    root     21538 21278 87 11:36 pts/2    00:01:13 python main.py
    root     21554 21278 87 11:36 pts/2    00:01:13 python main.py
    root     21887  3824  0 11:38 pts/2    00:00:00 ps -ef
    
    
    ps aux | grep "python" | grep -v "grep" | while read info; do pid=`echo ${info} | awk '{print $2}'`; echo "going to kill ${pid}"; kill ${pid}; done;
    

    会显示:

    going to kill 21278
    going to kill 21314
    going to kill 21330
    going to kill 21346
    going to kill 21347
    going to kill 21378
    going to kill 21394
    going to kill 21410
    going to kill 21426
    going to kill 21427
    going to kill 21428
    going to kill 21429
    going to kill 21460
    going to kill 21491
    going to kill 21522
    going to kill 21538
    going to kill 21554
    
    
  • 相关阅读:
    Qt 为何toggled无法触发setvisible(转)
    C++中const用法总结(转)
    C++输入输出流格式控制(转)
    ios-->iTunes同步应用失败
    apk签名
    常见缩写
    转:web_custom_request应用示例
    转:web_custom_request 函数
    转:web_submit_data函数
    转:web_custom_request 和 web_submit_data的差别
  • 原文地址:https://www.cnblogs.com/yanghailin/p/16528104.html
Copyright © 2020-2023  润新知