本文共 1361 字,大约阅读时间需要 4 分钟。
q :只显示pid,不显示class名称,jar文件名和传递给main方法的参数
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 :输出传递给main方法的参数,在嵌入式jvm上可能是null
Displays the arguments passed to the main method. The output may be null for embedded JVMs.l :输出应用程序main class的完整package名或者应用程序的jar文件完整路径名
Displays the full package name for the application’s main class or the full path name to the application’s JAR file.v(小写) 输出传递给JVM的参数
Displays the arguments passed to the JVM.V(大写) 隐藏输出传递给JVM的参数
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.给你举个例子,echo “aa bb cc” | awk -F ‘{print $1}’
结果就是aa,意思是把字符串按空格分割,取第一个,自己做个测试就明白了! awk是用来提取列的主要工具; {print $1}就是将某一行(一条记录)中以空格为分割符的第一个字段打印出来
xargs命令可以通过管道接受字符串,并将接收到的字符串通过空格分割成许多参数(默认情况下是通过空格分割) 然后将参数传递给其后面的命令,作为后面命令的命令行参数。
例如:
jps -l|grep ${project_name} |awk '{print $1}'|xargs kill -9
通过jps -l 找到机器上所以java进程,并以完整package名或者应用程序的jar文件完整路径名输出,然后grep 查询想要的进程。并提取第一列中的字符,然后用xargs 传递给 kill -9 做参数。
转载地址:http://ojhbb.baihongyu.com/