How would I find all the .htaccess files (recursively from current folder) that contain a particular string ('common.php') in my case?
What would be the command to do so?
If your shell is zsh
or bash
:
grep 'common\.php' **/.htaccess
(**
expands to any depth of subdirectories.)
This command will search all files in the current directory for that string:
grep -r "common.php" .
This had the advantage of it gives the filename - a better thing will probably be in @Rmano 's answer.
This will search for the .htaccess
file, then run grep on it.
find . -type f -iname '.htaccess' -exec grep -r "common.php" {} \;