Ulrich Drepper ([info]udrepper) wrote,
@ 2007-06-01 06:53:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
grep and color

I cannot believe there are still people who are surprised they see me working with the command line on my machine or when I tell them otherwise the the output of grep can use highlighting. Just add --color to the command line (with the optional argument just like ls). I've implemented that more than six years ago. In my .bashrc I have the following:

alias egrep='egrep --color=tty -d skip'
alias egrpe='egrep --color=tty -d skip'
alias fgrep='fgrep --color=tty -d skip'
alias fgrpe='fgrep --color=tty -d skip'
alias grep='grep --color=tty -d skip'
alias grpe='grep --color=tty -d skip'

Yes, I mistype grep often enough to warrant the extra aliases. Using tty as the color mode mean that if I pipe the output into another program there won't be any color escape sequences added which could irritate those programs.

Just make your life easier and add such aliases, too.



Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…