how to kill procs w same name, but myself

Posted on
Fri Feb 14, 2020 11:06 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

how to kill procs w same name, but myself

This took me > 3 hours to figure out .. so just in case someone has a similar problem

This code on linux will kill all procs with name proc_name besides myself (if I have that name ==> the grep -v $$)
Code: Select all
sudo kill -9 $(ps -ef | grep 'proc_name' | grep -v grep | grep -v $$ | awk '{print $2}')

This is tested in bash shell

Karl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests