当前位置:网站首页>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支持的正则表达式写法,这里不再赘述。(因为实在太罕见了)
边栏推荐
猜你喜欢
从底层结构开始学习FPGA----FIFO IP的定制与测试
修改px4飞控的系统时间
【C语言进阶篇】指针的8道笔试题
Make Jar, Not War
ClickHouse字段分组聚合、按照任意时间段粒度查询SQL
Force buckle 1037 Effective boomerang
微信公众号发送模板消息
子网划分、构造超网 典型题
Byte P7 professional level explanation: common tools and test methods for interface testing, Freeman
Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform
随机推荐
2022 Google CTF SEGFAULT LABYRINTH wp
C语言实例_5
[JS] obtain the N days before and after the current time or the n months before and after the current time (hour, minute, second, year, month, day)
taro3.*中使用 dva 入门级别的哦
Start from the bottom structure to learn the customization and testing of fpga---- FIFO IP
对C语言数组的再认识
Failed to successfully launch or connect to a child MSBuild. exe process. Verify that the MSBuild. exe
从底层结构开始学习FPGA----FIFO IP的定制与测试
免费白嫖的图床对比
AI 从代码中自动生成注释文档
【信号与系统】
According to the analysis of the Internet industry in 2022, how to choose a suitable position?
C language instance_ five
[case sharing] basic function configuration of network loop detection
Transplant DAC chip mcp4725 to nuc980
安全保护能力是什么意思?等保不同级别保护能力分别是怎样?
Set up [redis in centos7.x]
数据手册中的词汇
黑马笔记---异常处理
Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which