I have process which created multiple PID's. I want to kill all those PID's. I have tried
pkill <process_name>.
But PID not getting killed as they were wait to resource releasing.
I have managed to get PID list with
ps -ef | grep <process_name> | awk '{print $2}'
which gives process ID list but how can I kill all those listed PIDs ?
Thank you.
pgrep -lf <process_name>? if it gives only the relevant processes, you can kill withpkill -f <process_name>pgrep -lfverification covers everything that page warns about. You can see exactly what you are about to pkill.pgrep/pkilldifferent fromps -ef | grep <prco name>? Since it doesn't, you claim the authoritative answer is - since you didn't think to store the ppid in advance, you're out of luck. Don't trust ps names. They might lie.pgrep/pkillinstead ofps | grep; they're equally bad. If you read the linked web page it explains how to do it cleanly, by making sure that the parent process is responsible for killing/relaunching processes rather than relying on a PID file orpgrep/pkill. Of course, I assume OP is trying to automate this because of the form of the question. If that's not the case there's no point in being picky.