Find the pid of a java process under Linux

前端 未结 5 992
一生所求
一生所求 2020-12-30 00:37

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

5条回答
  •  庸人自扰
    2020-12-30 01:13

    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}'
    

提交回复
热议问题