I have a Java program running on a Linux computer, and want to find the process ID (pid) of its process. I know the ps command can provide this information, but
ps
You can use awk to get the pid:
ps -ef | grep MpiPageRank | awk '{print $2}'
I noticed that sometimes grep itself gets found, to remove it:
ps -ef | grep MpiPageRank | grep -v grep | awk '{print $2}'