How to kill the process using the name of the program instead of PID?

Use killall:

killall <the_process_name>

The pid in your example, the one that keeps changing, is the process ID of your grep trying to find the PID. That means that your ps and grep is not finding the actual process that you are looking for.

Try running your script without the trailing "&", to see what it is doing. Odds are it's failing quietly on you and not actually starting at all.

You can also use the System Monitor tool from the dash to see the full list of processes with process IDs.


you can use pkill to send kill signal same as kill signal

Eg: pkill firefox 
pkill -9 firefox

Tags:

Python

Process