Recursive grep in a directory on macOS

in Mac OS


If you need to look for a literal string in a directory and all its subdirectories, use grep -rF "your.literal.string" .

  • -r or --recursive: Recursively read all files under each directory.
  • -F or --fixed-strings: Treat the pattern as a literal string (not a regular expression). This is important if your string contains characters like . that you don’t want interpreted as regex. (For example, if you're looking through log files for a specific IP address.)
  • "your.literal.string": The exact string you're searching for.
  • .: Start the search from the current directory.
#macos #grep