PDA

View Full Version : kill a process by the pid


purga
1st June 2006, 05:18
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.

falko
1st June 2006, 18:38
Try this:
kill -9 `pgrep -u root shero`

EvanCarroll
11th June 2006, 09:50
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.

man pkill.
pkill -u root shero