Find process_id to be killed

Very often I need to kill some background job in unix.

To do this, I need to find its process_id to be passed to


kill -9 process_id

to be killed properly.

Here is quick way to combine finding process id for specific job:


ps aux | grep [my-fancy-filter-to-find-a task] |\
         awk '{print $2}'

This will just print process_id for my task to be killed.

Caution! Please, use this with care as if your grep return not the process_id  you are expecting – you may get to a trouble.

Leave a Reply

Your email address will not be published.