Menu
  • HOME
  • TAGS

get the pid of specified process name from pstree by using shell script

linux,bash,shell,pstree

You can use grep. <pstree command> | grep -P -o 'processTarget\([0-9]+\)' -P means use Perl regex -o mean only return the match man grep for more details If the goal is to get just the id you can continue this approach to return just the integer <pstree command> | grep...