Posts Tagged ‘grep’

DOS – The Default Option Set Series #1: GNU grep

May 27th, 2009 3 comments

With this post I will start an article series about default options for popular shell tools. And I would like to invite all of you to participate in this process to find a profound default option set for these tools. I will provide my current DOS as a discussion base and extend these by user comments.

In this first DOS its all about GNU grep.


Some fundamental information about the considered tool.

Name: GNU grep
Version: 2.5.3

How to set default options:

This section will describe how to set the Default Option Set. For grep its the environmental variable GREP_OPTIONS.

Default Option Set:

In this section comes a descriptive list of the options.

  • ignore binary files
  • use colored output in terminals
  • ignore special files like fifos, char and block devices
  • exclude patch *.rej and *.orig files
  • exclude common scm directories
  • exclude build directories


And here is a ready-to-use version of the option set.

export GREP_OPTIONS="--binary-files=without-match \
--color=auto \
--devices=skip \
--exclude='*.rej' \
--exclude='*.orig' \
--exclude-dir=.git \
--exclude-dir=.svn \
--exclude-dir=CVS \
--exclude-dir=patches \
--exclude-dir=.pc \
--exclude-dir=.libs \

Categories: bashism, DOS, linux Tags: , ,