To kill a process by its name
pkill python2
Get the pid like using grep
grep
pgrep python2 >>> 11123
By process name and its parameters, we use -f, which means 'full'
-f
pgrep -f "python2 test.py*"
Use pgrep with kill
pgrep
kill
kill -9 $(pgrep -f "python2 test.py*")