当前位置:网站首页>grep查找进程时,忽略grep进程本身
grep查找进程时,忽略grep进程本身
2022-07-06 18:05:00 【Channing Lewis】
ps -ef | grep '进程名' | grep -v grep
grep -v grep即去除结果中含有grep的进程。
但是要注意如果你的进程名中本身含有grep也会被忽略。
这时就需要更细致的规则,例如去除条件里加上一个空格:
ps -ef | grep '进程名' | grep -v 'grep '
因为grep进程是以grep+空格开头的,而一般进程不会这样,所以可以区分。
如果还区分不了可以考虑grep -v支持的正则表达式写法,这里不再赘述。(因为实在太罕见了)
边栏推荐
- Vocabulary in Data Book
- C语言实例_2
- AcWing 345. 牛站 题解(floyd的性质、倍增)
- The MySQL database in Alibaba cloud was attacked, and finally the data was found
- JTAG debugging experience of arm bare board debugging
- 【信号与系统】
- 设置Wordpress伪静态连接(无宝塔)
- 公钥\私人 ssh避password登陆
- Installation and testing of pyflink
- 一起看看matlab工具箱内部是如何实现BP神经网络的
猜你喜欢

Byte P7 professional level explanation: common tools and test methods for interface testing, Freeman

设置Wordpress伪静态连接(无宝塔)

1123. The nearest common ancestor of the deepest leaf node

微信公众号发送模板消息

Transformation transformation operator

LeetCode. 剑指offer 62. 圆圈中最后剩下的数

云呐|工单管理软件,工单管理软件APP

AI automatically generates annotation documents from code

ClickHouse字段分组聚合、按照任意时间段粒度查询SQL

HMM 笔记
随机推荐
736. Lisp 语法解析 : DFS 模拟题
JTAG principle of arm bare board debugging
微信公众号发送模板消息
Js逆向——捅了【马蜂窝】的ob混淆与加速乐
Sword finger offer II 035 Minimum time difference - quick sort plus data conversion
Can the system hibernation file be deleted? How to delete the system hibernation file
Case development of landlord fighting game
go-zero微服务实战系列(九、极致优化秒杀性能)
Let's see through the network i/o model from beginning to end
Force buckle 1037 Effective boomerang
云呐|工单管理软件,工单管理软件APP
Yunna | work order management software, work order management software app
Amway wave C2 tools
AI 从代码中自动生成注释文档
AcWing 1148. 秘密的牛奶运输 题解(最小生成树)
修改px4飞控的系统时间
JTAG debugging experience of arm bare board debugging
让我们,从头到尾,通透网络I/O模型
Set up [redis in centos7.x]
设置Wordpress伪静态连接(无宝塔)