Command Line Basics: Compare Files With diff
In my job as a mechanical engineer, I work with large text files for finite element analysis models. I sometimes have to run several iterations to evaluate different design proposals and I need to check my models against the baseline to make sure that only the intended changes are included. The tool I use to compare files is diff.
diff is a simple yet powerful command line tool. The basic functionality can be invoked like this:
By default, diff displays its output vertically, so part of the first file will be shown followed by the difference from the second file. There is however an option to show the differences side by side. You do this by activating the -y switch. You may need to expand your terminal window to make the results truly show side by side.
For more information about diff, check the man page or Info document.