Grep text/string in folder or subfolders - Linux Command

by Francis 2012-10-26 16:05:53

Method : 1
Grep the text in particular folder use this code
grep "image.png/search text" *
Explanation
To find the image.png in text of all extension (*) files.
If you need particular extension file use this code
grep "image.png/text" *.php

Method : 2
Grep the text in folder/directory and sub folder/directory use this code
grep -r -i "image.png/search text" ./
Explanation
To find the image.png in text folder and sub-folder of all extension (*) files.

Note :
-r, --recursive
Read all files under each directory, recursively; this is equivalent to the -d recurse option.
-i, --ignore-case
Ignore case distinctions in both the PATTERN and the input files.
2214
like
0
dislike
0
mail
flag

You must LOGIN to add comments