Any visual diff in Linux console?

Diff

Diff Problem Overview


Many years ago I used d32 which was available for DOS and Linux.

Is a non-GUI visual diff available for Linux like this one?

Any others than Vim and Emacs (Vim and Emacs are too powerful :-) )

Diff Solutions


Solution 1 - Diff

I'm using vimdiff. Or there is also sdiff.

Solution 2 - Diff

If you're comfortable with git, you can also use git diff to generate a patch for you. It'll usually give you nice colors, page to less, and output the unified diff format by default. It'll work regardless of whether the files are part of a git repository.

git diff -- file.a file.b

If file.a and file.b reside in a git repo and are untracked, you'll need to supply --no-index:

git diff --no-index -- file.a file.b

because git will diff against the index by default.

Solution 3 - Diff

None of the existing answers here quite fit my use case, but I found cdiff, which is a lovely little piece of software that does exactly what I need:

> Term based tool to view colored, incremental diff in a Git/Mercurial/Svn workspace or from stdin, with side by side and auto pager support.

Here's what the side by side mode looks like:

side by side diff output

Solution 4 - Diff

You can try ColorDiff.

Solution 5 - Diff

Vim comes with vimdiff which works pretty well...

Solution 6 - Diff

VS Code has beautiful diffing:

code --diff file1.ext file2.ext

Solution 7 - Diff

Personally I like to use vimdiff. But if you don't know vim that won't be that helpful to you.

Solution 8 - Diff

Midnight Commander (mc) has built-in diff and a lot more useful functions. Try:

> sudo apt install mc

Solution 9 - Diff

Your title mentions "Linux console" but your question mentions meld, which is a GUI application. It might help answerers if you could clarify this.

In GUI apps, meld is still pretty much the standard. It works well, it's reasonably pretty and intuitive.

If you're really limited to using the console (i.e. text-only) then apart from the diff utilities built into editors like vim and emacs you could also try the original command line utility diff. I find it very useful to use the -y option to display files side-by-side, and there are other options I've used to display "unified" diffs and to precisely set the amount of context around matched differences. If you pipe diff's output into less you can browse with fair convenience.

Solution 10 - Diff

vimdiff will do what you want. Vim is installed by default on most linux distros, so you probably do not even need to install anything.

Solution 11 - Diff

Emacs has a built-in visual diff tool: M-x ediff.

Solution 12 - Diff

I started to rebuild xxdiff in the console (since I've entirely switched to tmux console development) into a new Python-based single-file tool I call "termdiff". I ran into curses compatibility problems so I put this on the ice for now, I just need some time to fix minor issues with filling empty space, but it currently spits out output that looks just like xxdiff and you can pipe that into less.

http://furius.ca/xxdiff/bin/termdiff

Try termdiff --cat or termdiff --less, it works.

In the meantime I'm using a customized Emacs config and ediff, but it's a little sluggish to start, I'd still like a fast-startup dedicated diff program in the console.

Solution 13 - Diff

Try meld. It's very light and intuitive.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionleeditView Question on Stackoverflow
Solution 1 - DiffGregory PakoszView Answer on Stackoverflow
Solution 2 - DiffkristianlmView Answer on Stackoverflow
Solution 3 - DiffNick KnowlsonView Answer on Stackoverflow
Solution 4 - DiffyigitView Answer on Stackoverflow
Solution 5 - DiffrobinceView Answer on Stackoverflow
Solution 6 - DiffFreewalkerView Answer on Stackoverflow
Solution 7 - DiffJason AxelsonView Answer on Stackoverflow
Solution 8 - Diffaaa bbbView Answer on Stackoverflow
Solution 9 - DiffCarl SmotriczView Answer on Stackoverflow
Solution 10 - DiffDave KirbyView Answer on Stackoverflow
Solution 11 - DiffJesperEView Answer on Stackoverflow
Solution 12 - DiffblaisView Answer on Stackoverflow
Solution 13 - DifffrazzagliaView Answer on Stackoverflow