title: Find a process ID by name
body: <p>How can I find a pid by name or full command line in Ruby, without calling an external executable?</p>
  
  <p>I am sending SIGUSR2 to a process whose command line contained <code>ruby job.rb</code>. I would like to do the following without the call to <code>pgrep</code>:</p>
  
  <pre><code>uid = Process.uid
  pid = `pgrep -f "ruby job.rb" -u #{uid}`.split("\n").first.to_i
  Process.kill "USR2", pid
  </code></pre>