With --color=auto
, grep
will highlight the matching portion of the line in color when it outputs to a terminal, while avoiding the use of any potentially-harmful terminal control sequences when standard output goes somewhere else (like a file or pipe)… (Debian Administration)
Or just put a alias grep="grep --color=auto"
to .profile