i never liked pkill, you don't really know how many processes it will
match, and kill.  pgrep will show you what processes your query matches at
the moment, but still, if you then use pkill, you have to wonder if more
(or fewer) matching processes will exist at that moment.  a better approach
is to observe what pgrep matches, see if you like the results, and if so
feed those results to kill.  with these definitions:

>#pg uses pgrep to match some processes, saves them in $pg, and displays
them with psH.
>#kp then kills the saved list of processes.
>#psH is how i like to show a list of processes.  you could choose
different args for ps.
>alias psH='ps -Ho user,sess,tpgid,pgrp,ppid,pid,start,nice,wchan,stat,args
--cols 999'
>function pg { pg=($(pgrep -f "$@"));[[ $pg ]]&&echo ${pg[@]}&&psH
${pg[@]};}
>function kp { kill "$@" ${pg[@]};}

then you can:

>$ pg refo   #see what "refo" matches:
>1829 1968
>USER      SESS TPGID  PGRP  PPID   PID  STARTED  NI WCHAN  STAT COMMAND
>g         1742  2575  1828     1  1829 11:49:11   0 poll_s Sl
/usr/lib/firefox/firefox
>g         1742  2575  1828  1829  1968 11:54:01   0 poll_s Sl
/usr/lib/firefox/plugin-container
/opt/google/talkplugin/libnpgoogletalk.so...
>$ kp   #see if they'll die gracefully
>$ pg refo   #are they gone yet?
>$ kp -9   #if needed this would get 'em
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20151017/e3b1d5b5/attachment.html>