Getting PID by Name on FreeBSD
Getting the PID
of a process by name with and without the sysutils/psmisc
port.
Instructions:
The fallow example uses pgrep
in a bash script file:
The easy way is to install sysutils/psmisc
port and use the pidof
command:
Fallowing command can by used to get information to all of the processes matching a name:
Fallowing command can be used to get the PIDs of all processes matching a name:
Below script can be used to controll flow in a shell script. The -qs
flags supress grep output:
Reference:
My site is free of ads and trackers. Was this post helpful to you? Why not
Disqus is great for comments/feedback but I had no idea it came with these gaudy ads.