Monday, July 24, 2023

Killing processes by process name

Killing processes by process name

In order to kill multiple processes by name template use the ps -ef|grep NAME_OF_PROCESS|grep -v grep| awk '{print $2}' | xargs kill

root[+ASM1]@yuzdc1-n-b00001 ~ # ps -ef|grep CDBAUX|grep -v grep
oracle 1325 1 0 May08 ? 00:00:08 ora_w00b_CDBAUX
oracle 12727 1 0 May07 ? 00:00:09 ora_w003_CDBAUX
oracle 13370 1 0 May08 ? 00:00:08 ora_w00a_CDBAUX
oracle 24014 1 0 May08 ? 00:00:08 ora_w007_CDBAUX
oracle 80734 1 0 May07 ? 00:00:33 ora_pmon_CDBAUXR1
oracle 80736 1 0 May07 ? 00:00:48 ora_psp0_CDBAUXR1
......
oracle 149625 1 0 May11 ? 00:02:32 ora_o001_CDBAUX
oracle 184346 1 0 May08 ? 00:00:09 ora_w008_CDBAUX
root[+ASM1]@yuzdc1-n-b00001 ~ # ps -ef|grep CDBAUX|grep -v grep| awk '{print $2}' | xargs kill
root[+ASM1]@yuzdc1-n-b00001 ~ # ps -ef|grep CDBAUX|grep -v grep