Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm just trying to get grep to show all the lines, but the ones that match should have the matching text colored. Specifically I need this for something like this:

tail -f file.log | grep --color Exception

Unfortunately I don't see any option in grep that would simultaneous show the not matching lines and the lines that match (with color). Is there any other tool for this in unix/linux that would allow this?

share|improve this question

One work-around would be to use the context option with a large line count:

tail -f file.log | grep -C 1000 --color Exception

If you have ack it has an option for this:

tail -f file.log | ack --color --passthru Exception
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.