Shell script to get the process ID on Linux

Viewed 122211

I want to write a shell script (.sh file) to get a given process id. What I'm trying to do here is once I get the process ID, I want to kill that process. I'm running on Ubuntu (Linux).

I was able to do it with a command like

ps -aux|grep ruby
kill -9 <pid>

but I'm not sure how to do it through a shell script.

9 Answers
Related