Last Updated: September 09, 2019
·
92.9K
· pcollaog

Simple way to find a java process (linux)

If you want "kill" a java process maybe you will like to know the process identifier (PID), so you have to do this for know the PID (linux)

$ ps -fea|grep -i java

user  2895  8191  0 09:28 pts/1    00:00:00 grep -i java
user  4610  4607  1 Aug29 ?        01:40:00 /home/user/Software/java-7-sun/bin/java -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx768m -XX:MaxPermSize=256m -jar /home/user/Software/springsource/sts-3.3.0.RELEASE//plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar -os linux -ws gtk -arch x86_64 -showsplash -launcher /home/user/Software/springsource/sts-3.3.0.RELEASE/STS -name STS --launcher.library /home/user/Software/springsource/sts-3.3.0.RELEASE//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20130521-0416/eclipse_1506.so -startup /home/user/Software/springsource/sts-3.3.0.RELEASE//plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar --launcher.overrideVmargs -exitdata 518012 -product org.springsource.sts.ide -vm /home/user/Software/java-7-sun/bin/java -vmargs -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx768m -XX:MaxPermSize=256m -jar /home/user/Software/springsource/sts-3.3.0.RELEASE//plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.ja

First column is user that run the process, second column PID

So if you want to kill java process (in this example is STS/Eclipse) you have to do this:

$ kill -9 4610 #or any signal that you need

The most simple way to do this, is using jps command (Java Virtual Machine Process Status Tool):

$ jps

4610 org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
2952 Jps

Is the same information but just only JVM process and no more information, just necesary.

If you want more information, run with this parameter (full package names):

$ jps -l              

4610 /home/pcollaog/Software/springsource/sts-3.3.0.RELEASE//plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
3025 sun.tools.jps.Jps

jvm parameters

$ jps -v

4610 org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx768m -XX:MaxPermSize=256m
3157 Jps -Dapplication.home=/home/pcollaog/Software/jdk1.6.0_43 -Xms8m

The first column is the JVM Proccess, so... you have it for "kill" it.

Best Regards

1 Response
Add your response

Another good way;

  1. Install HTOP
  2. Press ‘/‘ (Search)
  3. Type searchterm: ‘java‘
  4. Press F10 (SIGTERM)
over 1 year ago ·