Get PID’s of multiple processes

I had to kill multiple deamon processes running for a long time. I could get the details about the process using the following command:

ps -ef | grep update3Parser | grep -v grep

But in order to get just the PID’s so I can efficiently kill them using a single command, I had to get the output of just the 2nd column. This is what I did:

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

After I had the output in a column, I used a regex word editor to replace \n with space and then used kill -9 PID’s to kill all the processes. Easy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s