You can use the OS X pgrep command to list all of the process IDs for an application, such as Safari.
$ pgrep Safari 51313 78209 95848 95874
If you wish to see the newest, i.e., the most recently started
one, of those processes, you can use the -n
option.
$ pgrep -n Safari 95874
You can use the -l
option to viewer longer information on
the processes, i.e, process names as well as PIDs.
$ pgrep -l Safari 51313 Safari 78209 SafariNotificat 95848 com.apple.Safar 95874 com.apple.Safar
If you combine the -l
option with the -f
option,
you will see even more information for the process that may be helpful when
the process name is truncated.
$ pgrep -lfn Safari 95874 /System/Library/PrivateFrameworks/SafariServices.framework/Versions/A/XPCS ervices/com.apple.SafariServices.xpc/Contents/MacOS/com.apple.SafariServices