How do you compare two similar files to check for differences? The obvious answer is to use the diff command in Linux.
The problem is that not everyone would be comfortable comparing files in Linux terminal. And the diff command output could be confusing for some.
Take this diff command output for example:
There is definitely a learning curve involved here. However, if you are using desktop Linux, you can use GUI applications to easily compare two files for any differences.
There are several GUI diff tools available for Linux. I am going to highlight my favorite tool Meld in this week’s Linux application highlight.
Meld: Visual Diff and Merge tool for Linux (and Windows)
With Meld, you can compare two files in side by side view. Not only that, you may also modify the files to make changes accordingly. That’s what you would want to do in most situations, right?
Meld is also capable of comparing directories and show which files are different. It will also show while files are new or missing.
You may also use Meld for a three-way comparison.
The graphical side-by-side comparison helps in a number of situations. If you are a developer, you can use it to understand code patches. Meld also supports version control systems like Git, Mercurial, Subversion etc.
Features of Meld
The open source Meld tools has the following main features:
- Perform two and three-way difference comparison
- Edit files in-place and the difference comparison updates immediately
- Navigate between differences and conflicts
- Visualize global and local differences with insertions, changes and conflicts marked accordingly
- Use regex text filtering to ignore certain differences
- Syntax highlighting
- Compare two or three directories for newly added, missing and altered files
- Exclude some files from comparison
- Support for popular version control systems like Git, Mercurial, Bazaar and SVN
- Support for many international languages
- Open source GPL v2 license
- Available for Linux as well as Windows
Installing Meld on Linux
Meld is a popular application and it is available in the official repositories of most Linux distributions.
Check your distribution’s software center and see if Meld is available.
Alternatively, you can also use command line package manager of your distribution to install Meld. On Ubuntu, it is available in the Universe repository and can be installed using the apt command:
sudo apt install meld
You may find the source code of Meld on GNOME’s GitLab repository:
Worth it?
I know that most modern open source code editors come with this feature but sometimes you just want a simple interface without the trouble of installing additional add-ons for comparing files. Meld provides you just that.
Do you use some other tools for checking differences between files? Which tool would that be? What’s your experience with Meld, if you ever used it? The comment sections is all yours for sharing your opinion.