0

I am newbie to Linux. I've following command which list all the 'oracle 'processes excluding those by root

ps -ef | grep oracle

root     15490 12939  0 Oct27 ?        00:00:00 sshd: oracle [priv]
54325    15576 15490  0 Oct27 ?        00:00:00 sshd: oracle@notty
root     25081 12939  0 11:20 ?        00:00:00 sshd: oracle [priv]
54325    25083 25081  0 11:20 ?        00:00:00 sshd: oracle@notty
root     25379 12939  0 11:21 ?        00:00:00 sshd: oracle [priv]
54325    25381 25379  0 11:21 ?        00:00:00 sshd: oracle@notty

I want to get value in the the 2nd column and use this value in a loop to kill that process.

I've tried using below command but no luck

  ps -ef | grep oracle | awk -F"," '{print $2}'

please advice how can i achieve this?

====Edit=====

thanks guys for your suggestions. I've updated my commands as below to get column 2 values but I also want to exclude processes by root and admin users. Also to put these values in a loop to kill the process.

 ps -ef | grep oracle | awk '{print $2}'

thanks

Muhammad
  • 611
  • 7
  • 14
  • 32

0 Answers0