通过管道ID杀死Linux进程 [英] Killing linux process by piping the id

查看:139
本文介绍了通过管道ID杀死Linux进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想终止一个进程,并使用以下命令获取其ID:

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

pgrep -f "python myscript.py"

我想打电话

kill -s SIGINT 

在它上面,但是我找不到任何方法.

on it, but I can't find any way to do it.

(命令必须在一行中)

推荐答案

尝试使用反引号运算符评估子命令

Try the backtick operator for evaluating a sub-command

kill -s SIGINT `pgrep -f "python myscript.py"`

(未经测试)

这篇关于通过管道ID杀死Linux进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆