当前位置:网站首页>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支持的正则表达式写法,这里不再赘述。(因为实在太罕见了)
边栏推荐
猜你喜欢

Transformation transformation operator

AcWing 361. 观光奶牛 题解(spfa求正环)

Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform

如何管理分布式团队?

LeetCode:1175. Prime permutation

405 method not allowed appears when the third party jumps to the website

Dark horse notes - exception handling

Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which

Lldp compatible CDP function configuration

2022 Google CTF SEGFAULT LABYRINTH wp
随机推荐
Google发布安全更新,修复Chrome中已被利用的0 day
ClickHouse字段分组聚合、按照任意时间段粒度查询SQL
Instructions for using the domain analysis tool bloodhound
Case development of landlord fighting game
405 method not allowed appears when the third party jumps to the website
tansig和logsig的差异,为什么BP喜欢用tansig
免费白嫖的图床对比
Gazebo的安装&与ROS的连接
Transformation transformation operator
树莓派/arm设备上安装火狐Firefox浏览器
HMM 笔记
交叉验证如何防止过拟合
AcWing 361. 观光奶牛 题解(spfa求正环)
系统休眠文件可以删除吗 系统休眠文件怎么删除
Yunna | work order management measures, how to carry out work order management
云呐-工单管理制度及流程,工单管理规范
AI automatically generates annotation documents from code
taro3.*中使用 dva 入门级别的哦
Make Jar, Not War
AcWing 1140. 最短网络 (最小生成树)