grep -v grep

1.grep 是查找含有指定文本行的意思,比如grep test 就是查找含有test的文本的行

2.grep -v 是反向查找的意思,比如 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
原文地址:https://www.cnblogs.com/zhangmingcheng/p/11634592.html