zoukankan      html  css  js  c++  java
  • ps 和 grep 查找消除 grep自身查找

    用ps -def | grep查找进程很方便,最后一行总是会grep自己。

    $ ps -def | grep dragonfly-framework
    dean      5273  5272  0 15:23 pts/5    00:00:00 newlisp ./dragonfly-framework/newlisp-redirection.lsp -http -d 8080 -w .
    dean      5491  5229  0 15:37 pts/16   00:00:00 grep --color=auto dragonfly-framework


    用grep -v参数可以将grep命令排除掉,因此修改版本如下:

    $ ps -def| grep dragonfly-framework | grep -v grep
    dean      5273  5272  0 15:23 pts/5    00:00:00 newlisp ./dragonfly-framework/newlisp-redirection.lsp -http -d 8080 -w .


    接在再用awk提取一下进程ID.

     ps -def | grep dragonfly-framework | grep -v grep | awk '{print $2}'
    5273

    转自:https://blog.csdn.net/csfreebird/article/details/41210493
  • 相关阅读:
    tp5 生成数据表
    tp5 事务
    时间
    api json
    php 函数学习
    win7 安装Ubuntu18.04 双系统后无法引导win7
    vite笔记
    tp5 excel导出
    tp5 sql查询
    idea 停止运行程序
  • 原文地址:https://www.cnblogs.com/liushui-sky/p/9241128.html
Copyright © 2011-2022 走看看