How to find a word inside a folder recursively in linux?

This can be done using grep command.

If you are searching in current directory use dot(.) as shown below

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


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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: