Search code examples
linuxprocesspidperf

identify perf's PID using top/ps


I need to kill perf in a bash script using its PID. However, unable to identify perf's PID (using top). Any pointers appreciated. Ubuntu XX 16.04.2. Thanks.


Solution

  • You can grep ps for the process and get its id from there. then use the output from that with your kill command.

    kill $(ps aux | awk '/perf/{print $2}')