Post

only search files with a specific extension with grep

Let’s say I want to find all instances of “strftime” in any .rb files in the current directory, starting in the current directory

I can use the --include=".rb" file to only apply my grep to .rb files:

1
$ grep -ri --include="*.rb" 'strftime' .
This post is licensed under CC BY 4.0 by the author.