In these examples, the
is the string we're searching for.
grep the README.md
grep the *
grep -r the *
grep -i the *
grep -l the *
grep -r --exclude-dir={.git,node_modules,dist} the *
grep -A 7 foo
# shows 7 lines after match
grep -B 7 foo
# shows 7 lines before match
grep -C 7 foo
# shows 7 lines before & after match
Case-insensitive recursive search in current directory, ommit unwanted folders, report the filenames only
grep -rli --exclude-dir={node_modules,spec,.node-gyp,dist,public,tmp,vendor,.next} foo ./
find . -name *.ts | xargs grep datSearchTerm