Killing linux process by piping the id

前端 未结 4 1818
一个人的身影
一个人的身影 2021-01-27 13:31

I want to kill a process and I get its id with:

pgrep -f \"python myscript.py\"

I would like to call

kill -s SIGINT 

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-27 14:23

    Read the man page, pgrep and pkill are the same program. Use pkill to send a signal to one or more processes which you can select in the same way as pgrep.

    pkill -INT -f "python myscript.py"
    

    See also this question and answer on unix.se (where this question would be a better fit).

提交回复
热议问题