How do i use grep to perform a recursive search in linux?



  • Man page for grep.

           -r, --recursive
                  Read all files  under  each  directory,  recursively,  following
                  symbolic  links only if they are on the command line.  Note that
                  if  no  file  operand  is  given,  grep  searches  the   working
                  directory.  This is equivalent to the -d recurse option.
    
           -R, --dereference-recursive
                  Read  all  files  under each directory, recursively.  Follow all
                  symbolic links, unlike -r.
    
    $ cd directory_to_search
    $ grep -r 'text_to_search'
    


© Lightnetics 2024