Diff-so-fancy is a free and open source file comparison application for Linux and Windows. Using diff-so-fancy, you can spot changes much easier because of colorful highlighting. It gives you better looking diffs for comparing strings, files, directories and git changes. It is released under MIT License and written in Perl.
How to Install diff-so-fancy on Ubuntu
To install Diff-so-fancy on Ubuntu Linux run below snap install command in the terminal application, it will install the latest version of Diff-so-fancy on your system.
sudo snap install diff-so-fancy
Install diff-so-fancy via PPA
Diff-so-fancy is also available as a Ubuntu PPA. In the terminal app (ctrl+alt+t), run below commands one by one. It will add Diff-so-fancy PPA and install it on your system. Confirm the addition and installation during the installation.
sudo add-apt-repository ppa:aos1/diff-so-fancy
sudo apt update
sudo apt install diff-so-fancy
Diff-so-fancy usage:
You can use diff-so-fancy on unified diff output like below. just replace file.txt and file.html with your files.
diff -u file.txt file.html | diff-so-fancy
It also supports the recursive mode, like below
diff -r -u folder_a folder_b | diff-so-fancy
You can check the the recommended colors
diff-so-fancy --colors
For the complete usage details run below command.
$ diff-so-fancy --h