File comparison is a common task, especially if you are software developer, tester, or a system/network admin. In Linux, there are multiple file comparison tools available, some are command-line based such as diff and diff3, while others are GUI-based like Meld.
One slight inconvenience that users of GUI-based diff tools face when initiating a file/folder comparison is that they have to launch the tool first, and then from one of its menus (usually the Open menu) open the files or folders that they want to compare.
Wouldn't it be better if you could just select the files that you want to compare, do a right-click, and open the files in the comparison tool of your choice?
If the idea excites you, or if that's what you were already looking for, you'll be glad to know that in this tutorial, we will quickly discuss how you can add a file compare option to Nautilus right-click menu in Ubuntu 16.04 LTS.
Add 'compare' option to Nautilus context menu
Adding the option is not at all difficult. All you have to do is to download and install nautilus-compare, which is a simple context menu file comparison extension for Nautilus 3 and above.
Here's how you can download and install it:
sudo apt-get install nautilus-compare
Once the above command is successful, head to Unity Dash, and open the 'Nautilus Compare Extension Preferences' app from there:
Here, you can select the comparison tool you want to use as the default option.
Compare Files in Nautilus
Now, all you have to do is to restart Nautilus using the following command:
nautilus -q
And you'll now be able to compare files by just selecting them and doing a right-click: