ps aux | grep, eliminate grep process from result

Today with zabbix i have urgent need to eliminate grep process by itself from result.

This is my command at startup:
ps -aux | grep pmon
The problem is that grep process is also listed in the result.

Solution is to add exactly grep -v grep just before actual grep:
ps -aux | grep -v grep | grep pmon
Another solution is to write your keywords first letter into square brackets:
ps -aux | grep "[p]mon"
What was your age when you had to deal with this situation for the first time?
I am 30 now!

1 comment:

  1. AnonymousJuly 13, 2022

    I think pgrep bash command is a more appropriate alternative now: https://linuxize.com/post/pgrep-command-in-linux/

    ReplyDelete