Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment

Find or Kill A Signal By Name In OS X

You can query whether a process is running by name. You can do this with ps and pipe the output to grep. It’s not hard, but you can do this more quickly with pgrep. You can also kill that process with pkill. Which includes the ability to send a signal.

So, let’s look at closing down iTunes with pkill:

pkill iTunes

Or we can send it with a signal (9):

pkill -9 iTunes

Or you could just grab the pid of a process by name:

pgrep Safari

It might display:

797

And that’s it. Easy Peasy.