0

I've set of processes with name process_name which is substring of execution.

I'm using following command to kill the process. I want to do this natively in python is there any way to do it without using subprocess.run() or installing any other dependency.

Command I'm using

pkill -f  'process_name'

System: 18.04

Mark Setchell
  • 169,892
  • 24
  • 238
  • 370
Pranjal Doshi
  • 621
  • 5
  • 20
  • Why are you not using `pkill` directly? Why are you showing Bash code if you want to do it from Python? You would need to obtain the PID somehow; how to do that is system-dependent, so you really need to specify on which OS you want to do this. – tripleee Oct 29 '21 at 06:52
  • @tripleee ohh yea.. I thought I was missing something. pkill -f 'process_name' should do it. But what's the good way to do it in python. And I'm using ubuntu 18.04 – Pranjal Doshi Oct 29 '21 at 07:07

0 Answers0