COLORDIFF(1)
π COLORDIFF β a tool to colorize diff output β¨
okay bestie, so colordiff?? it's literally a manual page from the User Commands girlies, and it's about to become your new obsession π
π NAME π
colordiff β a tool to colorize diff output π
β¨ SYNOPSIS β¨
colordiff [diff options] [colordiff options] {file1} {file2}
π¦ DESCRIPTION π¦
okay so here's the tea β β colordiff is a wrapper for diff, and it produces the same output as diff except with coloured syntax highlighting at the command line, which makes everything so much more readable. it's giving "Vim or Emacs with the syntax highlighting options turned on," no cap. the colour schemes can be read from a central configuration file or from a local user ~/.colordiffrc file. π
colordiff makes use of ANSI colours, and because of that it will only work when ANSI colours can be used β typical examples are xterms and Eterms, as well as console sessions. π (if your terminal can't do ANSI, she can't serve.)
colordiff has been tested on various flavours of Linux and under OpenBSD, but should be broadly portable to other systems. periodt. π
π« USAGE π«
use colordiff wherever you would normally use diff, or instead pipe output to colordiff:
for example:
$ colordiff file1 file2
$ diff -u file1 file2 | colordiff
you can pipe the output to less, using the -R option (some systems or terminal types may get better results using -r instead), which keeps the colour escape sequences β otherwise displayed incorrectly or discarded by less:
$ diff -u file1 file2 | colordiff | less -R
if you want to force disable colour escape sequences (for example, pipe the output to patch), you can use option --color=no to do so:
$ diff -u file1 file2 | colordiff --color=no | patch -p0 -d another-working-dir
if you have wdiff installed, colordiff will correctly colourise the added and removed text, provided that the -n option is given to wdiff:
$ wdiff -n file1 file2 | colordiff
you may find it useful to make diff automatically call colordiff. add the following line to ~/.bashrc (or equivalent):
alias diff=colordiff
any options passed to colordiff are passed through to diff except for the colordiff-specific option difftype, e.g.
colordiff --difftype=debdiff file1 file2
valid values for difftype are: diff, diffc, diffu, diffy, wdiff, debdiff; these correspond to plain diffs, context diffs, unified diffs, side-by-side diffs, wdiff output and debdiff output respectively. π«Ά use these overrides when colordiff is not able to determine the diff-type automatically.
alternatively, a construct such as cvs diff SOMETHING | colordiff can be included in ~/.bashrc as follows:
function cvsdiff () { cvs diff $@ | colordiff; }
or, combining the idea above using less:
function cvsdiff () { cvs diff $@ | colordiff |less -R; }
note that the function name, cvsdiff, can be customized. π
by default colordiff returns the exit code of the underlying diff invocation (if there is one), but there are some circumstances where it is useful to force colordiff's exit code to be zero: to do this use the option --fakeexitcode:
colordiff --fakeexitcode ...
π OPTIONS π
colordiff will send most options through to diff, but there are various colordiff-specific options which can be used:
--helpβ show these colordiff-specific options πββοΈ--color=(yes|no)β force (or suppress) display of colours in output π--color=patches=(yes|no)β force (or suppress) inclusion of colour codes in patch output π©Ή--color-term-output-onlyβ force colour to only appear in terminal output π»--difftype=DIFFTYPEβ force difftype detection to specified format.DIFFTYPEcan be:diff,diffc,diffu,diffy,debdiff,wdiffπ--(no)bannerβ show (or suppress) the colordiff banner π
π FILES π
/etc/colordiffrcβ central configuration file. user-specific settings can be enabled by copying this file to~/.colordiffrcand making the appropriate changes. πcolordiffrc-lightbgβ alternate configuration template for use with terminals having light backgrounds. copy this to/etc/colordiffrcor~/.colordiffrcand customize. π€οΈcolordiffrc-gitdiffβ alternate configuration template for use with terminals having dark backgrounds, with colour defaults set to match the output ofgit diff. copy this to/etc/colordiffrcor~/.colordiffrcand customize. π
π BUGS π
bug reports and suggestions/patches to <davee@sungate.co.uk> please. π (yes that's the real address, don't @ me)
π AUTHORS π
- Dave Ewart β
colordiffauthor and Debian packager - Graham Wilson β manual page and XML source author
- Colin Tuckley β Debian package sponsor
and that's the whole vibe check, bestie π this page is from the colordiff girlies, version stamped 12/22/2022, and it ate, no crumbs. go forth and colour your diffs πβ¨ππ¦
π¦ where this page comes from
- ubuntu resolute: apt-listdifferences 1.20230122build1 Β· MIT
- ubuntu stonking: apt-listdifferences 1.20230122build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms