title: Kill a process from Linux Application
body: <p>What is best and most efficient way to find pid of a specific task. Say:</p>
  
  <pre><code>ps -ef | grep "\/usr\/sbin\/watchdog" | cut -d" " -f2
  </code></pre>
  
  <p>Is there any more efficient way to find the same. I want to kill the watchdog process from my application. I am thinking using system command to do the same.</p>
  
  <pre><code>system("kill -9 `ps -ef | grep "\/usr\/sbin\/watchdog" | cut -d" " -f2`);
  </code></pre>
  
  <p>Is there any more optimized way of doing the same.</p>