Skip to content

Instantly share code, notes, and snippets.

@nepsilon
Last active February 19, 2017 12:37
Show Gist options
  • Save nepsilon/5dfa3a1473ba989f3054 to your computer and use it in GitHub Desktop.
Save nepsilon/5dfa3a1473ba989f3054 to your computer and use it in GitHub Desktop.
Search inside your files with grep — First published in fullweb.io issue #10

Search inside your files with grep

See how to use grep to find what you’re looking for inside files:

grep is case sensitive by default use -i to turn this off:

$ grep -i pattern file

Search recursively into a folder:

$ grep pattern -r folder

Display 5 lines after/before each match:

$ grep -C 5 pattern file

Filter out a pattern:

grep -v pattern file

Only count pattern occurrences:

$ grep -c pattern file

Only list the files containing the pattern:

$ grep -l pattern file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment