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
on it, but I can't find any way to do it.
(the command needs to be in one line)
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
on it, but I can't find any way to do it.
(the command needs to be in one line)
It's generally most convenient to use
xargs
to pass data from a pipe as arguments to a command that doesn't read data fromstdin
themselves:Read the man page,
pgrep
andpkill
are the same program. Usepkill
to send a signal to one or more processes which you can select in the same way aspgrep
.See also this question and answer on unix.se (where this question would be a better fit).
You can also kill a process by name
Try the backtick operator for evaluating a sub-command
(untested)