Skip to content

Instantly share code, notes, and snippets.

@alokm
Created January 30, 2012 20:53
Show Gist options
  • Save alokm/1706626 to your computer and use it in GitHub Desktop.
Save alokm/1706626 to your computer and use it in GitHub Desktop.
grep for specific text in a directory recursively
To search for text in files from the current folder (or directory, to follow Linux nomenclature), one can write:
grep "text" -R . -n --include=*.py
The parameters are as follows:
text the actual text to search for
-R Recurse to subdirectories
. start from the current directory
–include=*.py specifies a regular expression that searchable files must match (e.g. *.py)
–color makes the output pretty
-n shows the lines numbers of the lines that matched your search text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment