Like all of you, I use grep a lot to search through files. Actually, most of the time I use ack instead. It provides some really friendly defaults for searching for occurrences recursively, and I think its interface is for the most part more natural to work with.

When I do use grep, I want it to behave a lot like ack (without the default filters). By that, I mean that I want it to highlight the occurrences, I want line numbers, and I don’t care case-sensitivity. So I use something like:

$ grep -Rin --color=auto "search_thing" dir1 dir2 .. dirN

That’s a lot of typing. Luckily, grep supports an environment variable called GREP_OPTIONS. Stick something like this in your bash_profile:

export GREP_OPTIONS='--color=auto -R -i -n'

And then you can use grep like:

$ grep "search_thing" dir1 dir2 .. dirN

for your default behavior. Because I don’t like the default red color of the highlight, I also throw in:

export GREP_COLOR='0;93'

to change it to yellow. Enjoy!