Is there a 'rc' configuration file for grep/egrep? (~/.egreprc?)

No, there's no rc file for grep.

GNU grep 2.4 through 2.21 applied options from the environment variable GREP_OPTIONS, but more recent versions no longer honor it.

For interactive use, define an alias in your shell initialization file (.bashrc or .zshrc). I use a variant of the following:

alias regrep='grep -Er --exclude=*~ --exclude=*.pyc --exclude-dir=.bzr --exclude-dir=.git --exclude-dir=.svn'

If you call the alias grep, and you occasionally want to call grep without the options, type \grep. The backslash bypasses the alias.


ack can do what you want and more.

It will ignore binary files by default and you can tell it to ignore other filetypes as you want --notext, --nohtml, etc. It has the ability to define an rc file too so you can customize it with your own types.