Thursday, July 29, 2010

Pidof

pidof is a wonderful tool in linux that displays the pids of a given process. Unfortunately, MacOS doesn't come with this nifty tool so we need to create our own and add it to our ~/.profile. Here's the code, just add it to the end of your ~/.profile
pidof () { 
  ps -Ac | egrep -i chrome | awk '{printf $1;printf " "}';
  echo ""; 
}
Here's the results of this being run,
~$ pidof chrome
20867 83814 83833 83849 83850 83851 83852 83853 
~$ 

No comments:

Post a Comment