Last Updated: February 25, 2016
·
1.1K
· freyes12345

Avoid returning your command when grepping ps output

To avoid returning the command you ran when grepping through PS output in *NIX systems enclose the first character in brackets. For example instead of running:

ps -ef | grep 'foo'

and having the command you ran showing in the results run:

ps -ef | grep '[f]oo'