I am trying to use pidof or pgrep to be able to send a HUP to a process in my system. The problem is that I only want to kill the process with a precise parameter.
This is the output of 'ps awx'
657 ? S 0:00 processname software 658 ? S 0:00 processname demo 659 ? S 0:00 processname test
By doing one of these:
pidof processname pgrep processname
You get the list of all the processes starting by processname, but i'd like to do something like:
pidof processname test pgrep processname test
To retrieve only the PID I need (in this example would be 659)
By using the -f flag on pgrep just does what I wanted, by doing:
pgrep -f "processname test"
You'll get the right answer.