This can be done using grep command.
1 |
grep -nr 'searchstring' /yourdirectory |
If you are searching in current directory use dot(.) as shown below
1 |
grep -nr 'searchstring' . |
Options we have used
- -n : Show relative line number in the file
- -r : Recursively search subdirectories listed
- ‘searchString’ : String for search
- /yourdirectory : Directory for search
Example
1 |
grep -nr 'hello' . |
The above command will search for hello. So the output would be like
./first.log:70: My say hello and ….
./subdir/second.log:70: The hellolite app was used ..
To check more parameters use man grep
command.