Skip to content

Instantly share code, notes, and snippets.

@etoxin
Last active February 12, 2019 05:54
Show Gist options
  • Save etoxin/76dadc67d3a996f261d7 to your computer and use it in GitHub Desktop.
Save etoxin/76dadc67d3a996f261d7 to your computer and use it in GitHub Desktop.
GREP
Find a file.
$ find . fileName
Recursively find in *
grep -R 'etoxin' *
Exclude a directory
grep -R --exclude-dir=node_modules 'etoxin' *
Only output filenames
grep -rl 'todo' *
Ignore case
grep -ri 'todo' *
# finds todo & TODO
Find in a file
$ grep apple fruitlist.txt
$ grep apple *.txt
regex grep in file
$ grep ^a.ple fruitlist.txt
grep "[strawblue]berry" fruitlist.txt
Grep History
history | grep whatYouWantToFind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment