博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【linux is not unix】常用命令整理
阅读量:2240 次
发布时间:2019-05-09

本文共 1361 字,大约阅读时间需要 4 分钟。

文章目录

1-grep

  • ps -ef |grep project_name |grep -v grep :其中的grep -v grep为了去除包含grep的进程行 ,避免影响最终数据的正确性。

2-jps

  • jps
    Lists the instrumented Java Virtual Machines (JVMs) on the target system. This command is experimental and unsupported.
    列出当前系统上安装的java进程。

2-1参数

  • 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.

3-awk

给你举个例子,echo “aa bb cc” | awk -F ‘{print $1}’

结果就是aa,意思是把字符串按空格分割,取第一个,自己做个测试就明白了!
awk是用来提取列的主要工具;
{print $1}就是将某一行(一条记录)中以空格为分割符的第一个字段打印出来

4-xargs

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/

你可能感兴趣的文章
前端JSP与Spring MVC交互实用例子
查看>>
使用maven一步一步构建spring mvc项目
查看>>
hadoop map reduce 阶段笔记
查看>>
java jackcess 操作 access
查看>>
Git问题Everything up-to-date解决
查看>>
Hadoop HDFS文件操作的Java代码
查看>>
Hadoop学习笔记—3.Hadoop RPC机制的使用
查看>>
Hadoop学习笔记—22.Hadoop2.x环境搭建与配置
查看>>
JTS Geometry关系判断和分析
查看>>
GIS基本概念
查看>>
Java文件操作①——XML文件的读取
查看>>
java学习总结之文件操作--ByteArrayOutputStream的用法
查看>>
Java生成和操作Excel文件
查看>>
Java的三种代理模式
查看>>
java静态代理与动态代理简单分析
查看>>
JTS Geometry关系判断和分析
查看>>
阿里巴巴十年Java架构师分享,会了这个知识点的人都去BAT了
查看>>
Intellij IDEA 使用技巧一
查看>>
IDEA 护眼色设置 背景行颜色取消等设置
查看>>
idea如何显示git远程与本地的更改对比?
查看>>