博文背景
root@shanghai:/usr/local/redis-7.0.3# ps -ef | egrep redis
root 1815199 1 0 00:00 ? 00:01:28 ./src/redis-server 127.0.0.1:6379
root 1997222 1996120 0 19:23 pts/2 00:00:00 grep -E --color=auto redis
这个很丑陋,看着不习惯
root@shanghai:/usr/local/redis-7.0.3# ps -ef | egrep redis | egrep -v grep
root 1815199 1 0 00:00 ? 00:01:28 ./src/redis-server 127.0.0.1:6379
这个很麻烦,看着不习惯
解决办法
% ps -ef | egrep "[r]edis"
root@shanghai:/usr/local/redis-7.0.3# ps -ef | egrep "[r]edis"
root 1815199 1 0 00:00 ? 00:01:28 ./src/redis-server 127.0.0.1:6379
原理自己领悟,想想就很容易懂了。