Grep: Find Which Files Contain a Keyword

Use the grep command to search within files for a keyword

grep -Ri my_keyword /directory/to_search/
grep "Aug 28 .*2015" /directory/to_search/file_to_search.log |more


  1. Options Flag: - indicates that directive options will follow
  2. Recursively Search: R read all files under the directory
  3. Case Insensitive: i. Grep is case sensitive by default
  4. Wildcard Notation: .* matches any character for any length
  5. Fit Output to Screen: |more Pipe output “into more” and press Enter to see more results

  1. Search for Apache’s ServerTokens Directive
  2. Grep for text With Wildcard in between