How to give arguments to kill via pipe

user567879 picture user567879 · Dec 28, 2011 · Viewed 61.5k times · Source

I need to search for a certain process and kill that process. I wrote a command like this:

ps -e | grep dmn | awk '{print $1}' | kill

Where the process name is dmn. But it is not working. How can I find processes by name and kill them.

Answer

Daniel Persson picture Daniel Persson · Dec 28, 2011
kill $(ps -e | grep dmn | awk '{print $1}')