LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

colordiff

colored syntax highlighting wrapper for diff

TLDR

Compare files with colored output
$ colordiff [file1] [file2]
copy
Unified diff format
$ colordiff -u [file1] [file2]
copy
Pipe diff output through colordiff
$ diff -u [file1] [file2] | colordiff
copy
Side-by-side comparison
$ colordiff -y [file1] [file2]
copy
Compare directories
$ colordiff -r [dir1] [dir2]
copy
View with pager
$ colordiff [file1] [file2] | less -R
copy

SYNOPSIS

colordiff [diffoptions] file1 file2_

DESCRIPTION

colordiff is a wrapper for diff that produces the same output with colored syntax highlighting. Colors improve readability when viewing differences at the command line.All options are passed through to diff except colordiff-specific options.

PARAMETERS

All diff options are supported, plus:--difftype=type

Specify diff type: diff, diffc, diffu, diffy, wdiff, debdiff
Standard diff options:-u
Unified format
-c
Context format
-y
Side-by-side
-r
Recursive directory comparison

CONFIGURATION

/etc/colordiffrc

System-wide configuration
~/.colordiffrc
User configuration
Configuration sets colors for:- plain text- new text (added)- old text (removed)- diff commands

PAGER USAGE

Use less -R to preserve ANSI colors:

$ colordiff file1 file2 | less -R
copy

ALTERNATIVE

Modern diff (3.4+) supports built-in color:

$ diff --color file1 file2
copy

CAVEATS

Written in Perl. Requires ANSI color support in terminal (xterm, etc.). Colors can be customized via configuration files.

SEE ALSO

diff(1), git-diff(1), vimdiff(1)

Copied to clipboard
Kai