kill a process by the pid

Discussion in 'Programming/Scripts' started by purga, Jun 1, 2006.

  1. purga

    purga New Member

    I have a daemon named: shero

    I can use the following command to get the pid:
    pgrep -u root shero

    So, is there a one-line command to kill it? something like:
    kill (pgrep -u root shero)

    What's the exact expression?

    Thanks in advance.
  2. falko

    falko Super Moderator Howtoforge Staff

    Try this:
    kill -9 `pgrep -u root shero` 
  3. EvanCarroll

    EvanCarroll New Member HowtoForge Supporter

    man pkill.
    pkill -u root shero

Share This Page