Is it possible to retain the color while storing the diff output in a file?

This is working and showing the colors in terminal

colordiff -yW 1000 --suppress-common-lines file1 file2 > tempfile

But when I redirect the output to a file its not showing the colors.

colordiff -yW 1000 --suppress-common-lines file1 file2 > tempfile
  • 1
    Add --color=always. Commented Mar 31, 2017 at 16:44

2 Answers 2


If you always want color, modify your configuration file /etc/colordiffrc or ~/.colordiffrc as per the comment in the default file:

# By default, when colordiff output is being redirected
# to a file, it detects this and does not colour-highlight
# To make the patch file *include* colours, change the option
# below to 'yes'

Try opening tempfile in vim. When I do this, vim colors it just as I see in the terminal output.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .