Ubuntu – Highlighting with grep doesn’t work in Xterm

colorsgrepkubuntutailxterm

I've got a problem with Xterm.

When I use the command

tail -F example.log | grep -a -i -e 'examplestring'

in Xterm the "grepped" strings aren't highlighted in red like they would be in the normal terminal.

How can I fix this? Google didn't help me very much.

Best Answer

Open terminal ( Ctrl + Alt + T ) and type

export GREP_OPTIONS='--color=auto'. This will highlight the matched pattern of grep

To set it to Red color use: export GREP_COLOR='1;31'

For more color options check out this page

enter image description here

Related Question