很多时候,可以看到命令
ps -ef|grep gogs | grep -v grep | wc -l
其中的grep -v grep 是干啥的呢 ?
很简单 ,为了去除包含grep的进程行 ,避免影响最终数据的正确性 。
比如 ,
[isTester@iZ94b31ttqsZ]~# ps -ef|grep gogs
isTester.com 1883 1844 0 13:55 pts/0 00:00:00 grep gogs
git 6583 1 0 2018 ? 01:25:46 ./gogs web
加上grep -v grep ,就只剩下1行记录 。
[isTester@iZ94b31ttqsZ]~# ps -ef|grep gogs | grep -v grep
git 6583 1 0 2018 ? 01:25:46 ./gogs web
最后
以上就是妩媚糖豆最近收集整理的关于Linux命令:"grep -v grep"的作用 & 使用场景的全部内容,更多相关Linux命令:"grep内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复