Hi guys,
I am new to Unix shell scripting. Can anyone of you tell me how to kill all the processes at a time for a particular user?(No listing the process ID of each process in the kill -9 command).
Thanks in Advance,
-Hary
Hi guys,
I am new to Unix shell scripting. Can anyone of you tell me how to kill all the processes at a time for a particular user?(No listing the process ID of each process in the kill -9 command).
Thanks in Advance,
-Hary
Try this....
ps -ef | grep "USERID" | cut -f 3,4 -d " " | tr "\n" " " | xargs kill -9
This would work too.
ps -ef | grep USERID | grep -v grep | awk -F" " '{ print $2 }' | xargs kill -9
you can use pkill with -u option
Thanks everyone. It works!!
ps -fu <USERID>| awk -F" " '{ print $2 }' | xargs kill -9