To kill the one with the highest pid: Code: kill `pidof -s xkbd` If you want to kill a specific instance you need to store the PIDs as you launch them, $! is the last backgrounded process. Code: xkbd & PID1=$! xkbd & PID2=$! kill $PID1 You can also store the PIDs in named files if the launch script is separate from the kill script.
kill `pidof -s xkbd`
xkbd & PID1=$! xkbd & PID2=$! kill $PID1