2

This question already has an answer here:

What is the difference between

ps -ef | grep WDA 

and

ps -ef | grep [W]DA

How exactly [] rids of the unwanted info?

marked as duplicate by terdon Jul 9 '17 at 15:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    Usual reminder that pgrep can likely replace ps ... | grep ... and that pgrep is clever enough to not match itself. – thrig Jul 9 '17 at 13:46
3

WDA is a regular expression that matches itself. Thus the output will sometimes include the process listing for the grep process.

[W]DA is a regular expression that does not match itself. Thus the output will not include the process listing for the grep process.

Further reading

Not the answer you're looking for? Browse other questions tagged or ask your own question.