Science and technology

Examine Java processes on Linux with the jps command

On Linux, there are instructions to view processes working in your system. A course of is any ongoing occasion being managed by the kernel. A course of is spawned while you launch an software, however there are additionally many different processes working within the background of your laptop, together with applications to maintain your system time correct, to watch for brand new filesystems, to index information, and extra. The utilities, similar to these included within the procps-ng package, that monitor these processes are typically deliberately generic. They take a look at all processes in your laptop so you’ll be able to filter the listing primarily based on what you might want to know.

On Linux, you’ll be able to view processes with the ps command. It is the best strategy to view the working processes in your system.

$ ps
    PID TTY          TIME CMD
   4486 pts/0    00:00:00 bash
  66930 pts/0    00:00:00 ps

You can use the ps command to view working Java processes on a system additionally by piping output to grep.

$ ps ax |grep java
  67604 pts/1    Sl+    0:18 /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-4.fc34.x86_64/bin/java -D[Standalone] -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.internet.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true --add-exports=java.desktop/solar.awt=ALL-UNNAMED --add-exports=java.naming/com.solar.jndi.ldap=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.safety=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.administration/javax.administration=ALL-UNNAMED --add-opens=java.naming/javax.naming=ALL-UNNAMED -Dorg.jboss.boot.log.file=/dwelling/alan/wildfly/24.0.1/standalone/log/server.log -Dlogging.configuration=file:/dwelling/alan/wildfly/24.0.1/standalone/configuration/logging.properties -jar /dwelling/alan/wildfly/24.0.1/jboss-modules.jar -mp /dwelling/alan/wildfly/24.0.1/modules org.jboss.as.standalone -Djboss.dwelling.dir=/dwelling/alan/wildfly/24.0.1 -Djboss.server.base.dir=/dwelling/alan/wildfly/24.0.1/standalone

OpenJDK, nevertheless, has its very personal particular course of monitor. The Java Virtual Machine Process Status (jps) instrument means that you can scan for every working occasion of the Java Virtual Machine (JVM) in your system.

To view an identical output as seen within the ps command, use the -v choice. This is helpful, partly as a result of it requires much less typing.

$ jps -v
67604 jboss-modules.jar -D[Standalone] -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.internet.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true --add-exports=java.desktop/solar.awt=ALL-UNNAMED --add-exports=java.naming/com.solar.jndi.ldap=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.safety=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.administration/javax.administration=ALL-UNNAMED --add-opens=java.naming/javax.naming=ALL-UNNAMED -Dorg.jboss.boot.log.file=/dwelling/alan/wildfly/24.0.1/standalone/log/server.log -Dlogging.configuration=file:/dwelling/alan/wildfly/24.0.1/standalone/configuration/logging.properties

The default jps output supplies the method identifier and the category identify or Jar file identify of every detected occasion.

$ jps
67604 jboss-modules.jar
69430 Jps

Note: The man web page for jps states that it’s experimental and unsupported. Still, it is a nice-to-have choice as a result of usually many processes are working on a system, and having a fast strategy to determine solely Java is helpful.

Because Java continues to be a preferred language at the moment, being accustomed to the Java Development Kit and Runtime Environment stays essential. They comprise many instruments relevant to the event and upkeep of Java purposes.

Most Popular

To Top