Skip to content

Instantly share code, notes, and snippets.

@tizee
Created May 19, 2020 08:55
Show Gist options
  • Save tizee/b6faa4b50d009ee809b3dd19daf4a174 to your computer and use it in GitHub Desktop.
Save tizee/b6faa4b50d009ee809b3dd19daf4a174 to your computer and use it in GitHub Desktop.
find files containing specific text
# reference https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux
## 1. grep
grep -rnw '/path/to/somewhere/' -e 'pattern'
## 2. ack
ack 'text-to-find-here'
## 3. grep with find
find . -name '*.js' -exec grep -i 'string to search for' {} \; -print
# or
find . -type f -exec grep -l "Apache License" {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment