So we all have the diff command installed by default. I certainly don't know how to use it well. But I would expect some reasonable default usage. Yet when I type diff file1 file2 I get ... a text ... which I have to parse in my head ... which is not helped by the fact that this is a weird combination of two texts, which are in turn very complex themselves.

So I looked for a graphical solution, e.g. meld. That works much much better out of the box.

Yet I would prefer to have the luxury of staying on the command line all the time. Is there a fairly standard command which:

  • uses colour by default and can adopt syntax highlighting
  • presents side-by-side diffs and does 3-way merges by default
  • works on the command line, e.g. via libncurses
  • depends on neither vim, emacs nor an IDE
  • can modify edited files in place?

If not, why not? I looked into colordiff but it doesn't quite cut it.

  • 4
    Using --unified option makes the diff output much more readable.
    – wurtel
    Feb 5, 2019 at 15:34
  • 1
    sdiff with the -o option will do an interactive merge to a third file, but it doesn't do syntax highlighting nor in-place editing. Feb 5, 2019 at 15:46

2 Answers 2


Sounds like delta would meet many of these requirements:


Summary features:

  • Language syntax highlighting ...
  • Word-level diff highlighting ...
  • Side-by-side view with line-wrapping
  • Improved merge conflict display
  • Code can be copied directly from the diff (-/+ markers are removed by default).
  • GitHub/GitLab/Bitbucket page (--hyperlinks). File paths can also be formatted as hyperlinks for opening in your OS.


Sample screenshot from above link:

enter image description here


I fear that this answer will not satisfy you, but I think that you pose conflicting constraints.

About diff

But first I have to defend the classical diff tool: Its main purpose is to generate software patches that are supposed to be processed by machines on application. In addition, these patches are designed to be as compact as possible and to ideally use only ASCII characters, so that they can be shared fast and reliably via e-mail, Usenet, etc.

That these patches can be read by humans (and understood by some humans) is also an important property, but not top priority.

Your question

I fully understand and share your desire for simple and elementary command line tools, but a side by side diff, possibly with color highlighting, is neither simple nor does it lie within the scope what we can expect from a real command line tool, simply because it is not line orientated any more.

What comes next to it are Vi or Emacs based tools, which are as simple and clear for human reception as it can be, being highly flexible at the same time. They also offer powerful merging capabilities.

From those, vimdiff was already mentioned in the comments.

Concerning Emacs, file comparisons are typically started from within the editor. The most commonly used tool for that is Ediff, which offers umpteen entry points that correspond to the various needs: comparison of two files, tree files, one of them treated as a common ancestor, and so on. The same with possible merges.

Albeit unusual, I rigged up an access to Ediff from the command line: If you start Emacs with

emacs FILE1 FILE2 -nw --eval "(apply 'ediff-buffers (last (nreverse (buffer-list)) 2))"

then you jump directly in an interactive Ediff session that compares FILE1 and FILE2 within your terminal. If you omit the -nw option (and all requirements are met), you get the same session in a separate graphical frame. See also this related question by ashutosh jain.

Okay, I would not go so far to call Emacs an easy tool. But if you study it thoroughly for some years, you will love it. (Personal opinion.)

So, unfortunately no: I do not know any tool that meets all of your constraints.

  • 6
    "for some years"
    – Vorac
    Jun 23, 2020 at 21:39

You must log in to answer this question.

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