Monday, 29 August 2022

Killing a process (extracting PID with grep)

I can never remember the finer details of grep. Here I kill a particular python application by using a sequence of piped greps. The last grep to the right as the '-o' option to extract the PID of our particular Python application we wish to terminate. kill -9 $(ps -ax | grep python | grep replay.py | grep -o '^[0-9]*')

No comments:

Post a Comment