Jun 19, '03 10:33:00AM • Contributed by: adamjacobmuller
#!/bin/sh
ps axc|awk "{if (\$5==\"$1\") print \$1}";
Place this in a script (/bin/pidof is a good idea) and chmod it 755 (chmod 755 /bin/pidof) (or 700 if you are paranoid). Once in place, you can find the PID number of any running program by typing (for example) pidof iTunes; if you want to kill a program, you can just type kill `pidof iTunes`.
A lot of the custom scripts I have written in the past years work well on OS X; in particular one program that I love is gjukebox, a web-based MP3 jukebox that works on OS X with a few tweaks -- except for the lack of a pidof command.
[robg adds: I tested this one, and it worked as expected.]
