From e123e6a8898e328d383eb65283a425a5203fe70d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 Oct 2021 05:03:39 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020211006=20Chec?= =?UTF-8?q?k=20Java=20processes=20on=20Linux=20with=20the=20jps=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20211006 Check Java processes on Linux with the jps command.md --- ...processes on Linux with the jps command.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20211006 Check Java processes on Linux with the jps command.md diff --git a/sources/tech/20211006 Check Java processes on Linux with the jps command.md b/sources/tech/20211006 Check Java processes on Linux with the jps command.md new file mode 100644 index 0000000000..b7c1c0cdfe --- /dev/null +++ b/sources/tech/20211006 Check Java processes on Linux with the jps command.md @@ -0,0 +1,73 @@ +[#]: subject: "Check Java processes on Linux with the jps command" +[#]: via: "https://opensource.com/article/21/10/check-java-jps" +[#]: author: "Alan Formy-Duval https://opensource.com/users/alanfdoss" +[#]: collector: "lujun9972" +[#]: translator: " " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " + +Check Java processes on Linux with the jps command +====== +With many processes running on a system, it's useful to have a quick way +to identify only Java with the jps command. +![Coffee beans][1] + +On Linux, there are commands to view processes running on your system. A process is any ongoing event being managed by the kernel. A process is spawned when you launch an application, but there are also many other processes running in the background of your computer, including programs to keep your system time accurate, to monitor for new filesystems, to index files, and more. The utilities, such as those included in the [procps-ng package][2], that monitor these processes tend to be intentionally generic. They look at all processes on your computer so you can filter the list based on what you need to know. + +On Linux, you can view processes with the `ps` command. It is the simplest way to view the running processes on 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 running Java processes on a system also 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.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true --add-exports=java.desktop/sun.awt=ALL-UNNAMED --add-exports=java.naming/com.sun.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.security=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.management/javax.management=ALL-UNNAMED --add-opens=java.naming/javax.naming=ALL-UNNAMED -Dorg.jboss.boot.log.file=/home/alan/wildfly/24.0.1/standalone/log/server.log -Dlogging.configuration=file:/home/alan/wildfly/24.0.1/standalone/configuration/logging.properties -jar /home/alan/wildfly/24.0.1/jboss-modules.jar -mp /home/alan/wildfly/24.0.1/modules org.jboss.as.standalone -Djboss.home.dir=/home/alan/wildfly/24.0.1 -Djboss.server.base.dir=/home/alan/wildfly/24.0.1/standalone +``` + +OpenJDK, however, has its very own specific process monitor. The Java Virtual Machine Process Status (jps) tool allows you to scan for each running instance of the Java Virtual Machine (JVM) on your system. + +To view a similar output as seen in the `ps` command, use the `-v` option. This is useful, partly because it requires less typing. + + +``` +$ jps -v +67604 jboss-modules.jar -D[Standalone] -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true --add-exports=java.desktop/sun.awt=ALL-UNNAMED --add-exports=java.naming/com.sun.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.security=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.management/javax.management=ALL-UNNAMED --add-opens=java.naming/javax.naming=ALL-UNNAMED -Dorg.jboss.boot.log.file=/home/alan/wildfly/24.0.1/standalone/log/server.log -Dlogging.configuration=file:/home/alan/wildfly/24.0.1/standalone/configuration/logging.properties +``` + +The default `jps` output provides the process identifier and the class name or Jar file name of each detected instance. + + +``` +$ jps +67604 jboss-modules.jar +69430 Jps +``` + +**Note:** The man page for `jps` states that it is experimental and unsupported. Still, it's a nice-to-have option because often many processes are running on a system, and having a quick way to identify only Java is useful. + +Because Java is still a popular language today, being familiar with the Java Development Kit and Runtime Environment remains important. They contain many tools applicable to the development and maintenance of Java applications. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/21/10/check-java-jps + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) +[2]: https://opensource.com/article/21/8/linux-procps-ng From d544b412f527fd30c1e6d54d7194052c1a115232 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 Oct 2021 05:03:48 +0800 Subject: [PATCH 2/3] add done: 20211006 Check Java processes on Linux with the jps command.md --- sources/tech/20211007 .md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 sources/tech/20211007 .md diff --git a/sources/tech/20211007 .md b/sources/tech/20211007 .md new file mode 100644 index 0000000000..05999a471f --- /dev/null +++ b/sources/tech/20211007 .md @@ -0,0 +1,25 @@ +[#]: subject: "" +[#]: via: "https://www.2daygeek.com/repair-corrupted-xfs-filesystem-root-partition-rhel-8/" +[#]: author: " " +[#]: collector: "lujun9972" +[#]: translator: " " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " + + +====== + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/repair-corrupted-xfs-filesystem-root-partition-rhel-8/ + +作者:[][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[b]: https://github.com/lujun9972 From ab4f55b2c388b858870cd1a915c78ebe4c1bbea9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Oct 2021 08:39:24 +0800 Subject: [PATCH 3/3] Delete 20211007 .md --- sources/tech/20211007 .md | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 sources/tech/20211007 .md diff --git a/sources/tech/20211007 .md b/sources/tech/20211007 .md deleted file mode 100644 index 05999a471f..0000000000 --- a/sources/tech/20211007 .md +++ /dev/null @@ -1,25 +0,0 @@ -[#]: subject: "" -[#]: via: "https://www.2daygeek.com/repair-corrupted-xfs-filesystem-root-partition-rhel-8/" -[#]: author: " " -[#]: collector: "lujun9972" -[#]: translator: " " -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " - - -====== - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/repair-corrupted-xfs-filesystem-root-partition-rhel-8/ - -作者:[][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: -[b]: https://github.com/lujun9972