Register now and start sharing your code snippets.
-->

Find out the process id of a process you know how to single out with grep.

Shell Script (Bash) posted about 1 year ago by marko

The cut program can be really versatile. Give it the character used to separate columns using the -d switch, and the column(s) you want to print using the -f switch. Here we give ’ ’ as a parameter to the -d switch because spaces indicate the columns here. A single column is given using -fn and multiple columns using -fn,n,n,n,n syntax.

   1  ps axu |grep FitNesse | grep java |grep -v grep | cut -d' ' -f3

Tagged linux, cut, pid, process id