7

Java JPS commands under Linux are parsed in detail

 2 years ago
source link: https://developpaper.com/java-jps-commands-under-linux-are-parsed-in-detail/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Java JPS commands under Linux are parsed in detail

Time:2019-10-7

To display information about a process in Linux environment, you may always use PS commands, such as the following commands to display Java processes executed by the current system:


ps -ef | grep java

For Java processes, JDK1.5 later provides a small tool to view all current java process pids.

position

JAVA_HOME/bin/under the directory

function

JPS (Java Virtual Machine Process Status Tool) is a command provided by JDK 1.5 to display the PID of all current Java processes. It is simple and practical. It is very suitable for simple inspection of current Java processes on linux/unix platform.

Use

Execute JPS – help first to see how this command is used


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

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

Specific [options] option resolution:

– q: Output only VM identifiers, excluding classname, jar name, arguments in main method;
– m: Output main method parameters;
– l: Output complete package name, apply main class name, complete path name of jar;
– v: output JVM parameters;
– V: The output is passed to the JVM parameters through the flag file (. hotspotrc file or – XX: Flags = specified file);

Example

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 combine parameters, such as


jps -ml

Special instructions

JPS only finds the Java processes of the current user, not all processes in the current system.

Thank you for reading. I hope to help you. Thank you for your support.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK