To show output in both terminal and to a file, tee
can be used like below
ls --color=auto | tee opfile
But now, there is no color in the terminal. If I force colors, opfile also has colors which affects greping and other tools that parse the opfile.
ls --color=always | tee opfile # Now opfile has colors
Is there a way to to have colors in terminal but not in output file? Showing ls
for example. Assume it is some command that compiles and spits out errors.