![]() In other words, it will look into sub-directories too. The -r option read/sarch all files under each directory, recursively, following symbolic links only if they are on the command line. Recurse in directories skip file matching PATTERN.Īs you’ve seen, the grep -r command makes it easy to recursively search directories for all files that match the search pattern you specify, and the syntax is much shorter than the equivalent find/grep command.įor more information on the find command, see my Linux find command examples, and for more information on the grep command, see my Linux grep command examples. The syntax is as follows for the grep command to find all files under Linux or Unix in the current directory: cd /path/to/dir grep -r 'word'. Recurse in directories only searching file matching PATTERN. Read all files under each directory, recursively this is Here’s the section of the Linux grep man page that discusses the -r flag:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |