How to grep two strings or words in file on Linux

I need to find two words or string in file. So i try

grep -w word1 file | grep -w word2
grep -w string1 file | grep -w string2

It is not working at all. Why don’t grep support searching two words? Is it even possible?

Try:

grep -w 'word1\|word2' file

See my tutorial page for more info: