Detailed explanation of java jps command use parsing under Linux

  • 2021-12-05 06:59:44
  • OfStack

Display the information of 1 process in Linux environment. Everyone may be using ps command directly. For example, use the following command to display the Java process currently executed by the system:


ps -ef | grep java

For java processes, jdk 1.5 provides a gadget to view all current java processes pid.

Position

JAVA_HOME/bin/ Directory

Function

jps (Java Virtual Machine Process Status Tool) is a command provided by JDK 1.5 to show all the current java processes pid. It is simple and practical, and is very suitable for simply viewing the current java process on linux/unix platform.

Use

Execute jps-help first to see how to use this command under 1


# jps -help
usage: jps [-help]
    jps [-q] [-mlvV] [<hostid>]

Definitions:
  <hostid>:   <hostname>[:<port>]

Specific [options] option resolution:

-q: Output only VM identifier, excluding classname, jar name, arguments in main method;
-m: Output the parameters of main method;
-l: Output full package name, application main class name, jar full path name;
-v: Output jvm parameters;
-V: The output is passed through the flag file to the parameter in JVM (. hotspotrc file or the file specified by-XX: Flags =;

Instances

jps command:


[root@119 app]# jps
16464 jar
2300 jar

jps-q:


[root@119 app]# jps -q
16464
2300

jps -m


[root@119 app]# jps -m
16464 jar
2300 jar

jps -l


[root@119 app]# jps -l
16464 test-1.0.0-SNAPSHOT.jar
9671 sun.tools.jps.Jps

Of course, you can also use parameters in combination, such as


jps -ml

Special description

jps looks only for the current user's Java process, not all processes on the current system.

Thank you for reading, hope to help everyone, thank you for your support to this site!


Related articles: