Yuriy Markiv blog

TECH

searching using grep (linux) - few tips to start

17 September, 2018 | tech

Find keyword1 in directory1 and all subdirectories and disregard letters case:

grep -i "keyword1" /direcotry1/* -R

Find keyword2 in search results from previous request and disregard letters case:

grep -i "keyword1" /direcotry1/* -R | grep -i "keyword2"

What is cool is that you may use as many "search results from previous request" as you want. So, you may put:

grep -i "keyword1" /direcotry1/* -R | grep -i "keyword2" | grep -i "keyword3" | ... | grep -i "keywordNNN"

(can't honestly say that linux is better than windows in general, but mentioned feature works better in linux from this point of view).