jps只显示java应用程序,与ps -ef | grep java作用类似。
一、先man jps查看命令描述选项
$ man jps
OPTIONS
The jps command supports a number of options that modify the output of the command. These options are subject to change or removal in the
future.
-q
Suppresses the output of the class name, JAR file name, and arguments passed to the main method, producing only a list of local JVM
identifiers.
-m
Displays the arguments passed to the main method. The output may be null for embedded JVMs.
-l
Displays the full package name for the application’s main class or the full path name to the application’s JAR file.
-v
Displays the arguments passed to the JVM.
-V
Suppresses the output of the class name, JAR file name, and arguments passed to the main method, producing only a list of local JVM
identifiers.
二、用法举例
1、列出进程号、应用程序包名或类名
$ jps
10097 Jps
6755 KnDeviceTagConsumer
24261 LoadCreditRating
23943 fd-recommend-dubbo-provider.jar
14808 fd-recommend-dubbo-consumer.jar
28697 Bootstrap
9449 KnApplistTagConsumer
7818 dubbo-admin-0.0.1-SNAPSHOT.jar
2、列出进程号、详细包名或路径
$ jps -l
10114 sun.tools.jps.Jps
6755 com.feidee.bigdata.recommend.tag.device.KnDeviceTagConsumer
24261 com.feidee.bigdata.listserv.creditrating.LoadCreditRating
23943 /usr/local/tomcat/fd-recommend-dubbo/fd-recommend-dubbo-provider/lib/fd-recommend-dubbo-provider.jar
14808 /usr/local/tomcat/fd-recommend-dubbo/fd-recommend-dubbo-consumer/lib/fd-recommend-dubbo-consumer.jar
28697 org.apache.catalina.startup.Bootstrap
9449 com.feidee.bigdata.recommend.tag.device.KnApplistTagConsumer
7818 ./dubbo-admin-0.0.1-SNAPSHOT.jar
32748 org.apache.catalina.startup.Bootstrap
6878 com.feidee.bigdata.recommend.iteminfo.KnItemInfoConsumer
3、只列出进程号
$ jps -q
6755
24261
23943
14808
28697
9449
7818
10154
32748
6878
4、列出jvm详细参数
$ jps -v
6755 KnDeviceTagConsumer
24261 LoadCreditRating
23943 fd-recommend-dubbo-provider.jar -Xms1g -Xmx1g
14808 fd-recommend-dubbo-consumer.jar
11369 Jps -Denv.class.path=.:/usr/jdk1.8.0_51/lib/dt.jar:/usr/jdk1.8.0_51/lib/tools.jar -Dapplication.home=/usr/jdk1.8.0_51 -Xms8m
28697 Bootstrap -Dnop -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -XX:MaxNewSize=687865856 -XX:NewSize=687865856 -Xms1024m -Xmx1024m -Djava.endorsed.dirs=/usr/local/tomcat/tomcat-fd-listserv/endorsed -Dcatalina.base=/usr/local/tomcat/tomcat-fd-listserv -Dcatalina.home=/usr/local/tomcat/tomcat-fd-listserv -Djava.io.tmpdir=/usr/local/tomcat/tomcat-fd-listserv/temp
9449 KnApplistTagConsumer
7818 dubbo-admin-0.0.1-SNAPSHOT.jar
32748 Bootstrap -Dnop -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.security.auth.login.config=/home/testknpub/tomcat/kerberos_files/kafka_client_jaas.conf -Djava.security.krb5.conf=/home/testknpub/tomcat/kerberos_files/krb5.conf -XX:MaxNewSize=687865856 -XX:NewSize=687865856 -Xms1024m -Xmx1024m -Djava.endorsed.dirs=/home/testhadoop/tomcat/tomcat_18001/endorsed -Dcatalina.base=/home/testhadoop/tomcat/tomcat_18001 -Dcatalina.home=/home/testhadoop/tomcat/tomcat_18001 -Djava.io.tmpdir=/home/testhadoop/tomcat/tomcat_18001/temp
6878 KnItemInfoConsumer