How to do diff like `git diff –word-diff` without git on Linux?

The result of git by git diff --word-diff is great. But how to do diff like git diff --word-diff without git on Linux? The plain diff command on Linux seems not accept options like --word-diff.

The wdiff is for word-diff:

wdiff program is a front end to diff for comparing files on a word per word basis. A word is anything between whitespace.

$ wdiff file1 file2

Bonus: colordiff is a wrapper for ‘diff’. colordiff is written in Perl and produces the same output but with pretty ‘syntax’ highlighting.

$ wdiff file1 file2 | colordiff


$ wdiff file1 file2 | colordiff | less -R

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

One comment:

  1. Not exactly what you’re asking for, but you could pipe plain diff output through riff:

    diff a.txt b.txt | riff

    Riff will highlight what words were added / removed in the diff, which might be exactly what you want. Riff also integrates with git and pages its result just like git diff.

    Get it here: .

    Disclaimer: I’m the riff author.

Leave a Reply

Your email address will not be published. Required fields are marked *