pidof

Display the PID number for a given process name

brewmacoslinux
Try with needOr install directly
Source

About

Display the PID number for a given process name

Commands

pidof

Examples

Find the PID of a running process by name$ pidof bash
Find PIDs of all instances of a process$ pidof firefox
Kill a process by finding its PID with pidof$ kill $(pidof nginx)