Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to colorize diff on the command line

When I have a diff, how can I colorize it so that it looks good?

I want it for the command line, so please no GUI solutions.

like image 934
daniel kullmann Avatar asked Jan 10 '12 08:01

daniel kullmann


1 Answers

Man pages for diff suggest no solution for colorization from within itself. Please consider using colordiff. It's a wrapper around diff that produces the same output as diff, except that it augments the output using colored syntax highlighting to increase readability:

diff old new | colordiff 

or just:

colordiff old new 

Installation:

  • Ubuntu/Debian: sudo apt-get install colordiff
  • OS X: brew install colordiff or port install colordiff
like image 190
kaji Avatar answered Sep 21 '22 00:09

kaji