Grep & Regex & Find strings
Grep To find Files and Strings
We can use GREP to find some keywords and files and some special strings
grep -inr password
i is for case insensitivity
n is for line number
r is for recursively
this command will recursively search for the keyword password
Grep to find strings using Regex
lets say we have a file with a certain line

now i need to find in how many files this line exists, so i can use regex with grep
grep -rnw $(pwd) -e "^.*user_location.*public.*" --color
$(pwd)- means your current working directory in which you want to find
otherwise give the complete path of the directory here
this command will find you the all files having above line
Egrep to do Advanced Regex
We can use egrep for more advanced regular expressions, below is the egrep command with more advacned regex which finds for $addslahses keyword and whatever is after that.
egrep '\$addslashes.*=.*' $(pwd) -r --color
Find Command
find / -iname "*.html"
Last updated