Home > Linux > Linux Command: diff – What’s the difference?

Linux Command: diff – What’s the difference?

Sometimes it’s necessary to quickly determine the difference between two files. The command “diff” can be particularly useful if you find yourself in this situation.

The most simple usage of diff is “diff <oldfile> <newfile>”.

The output looks like this:
image

The output of diff is really how to alter the original file to match the new file. “1a2” means to add a new line to the old file after line 1. This line should be “bar” as signified by the “>” mark.

Often patches are distributed using the diff file. PHPBB usually offers this as a way to patch their open source code. In short, using diff can save you time and offer a way to compare to configuration files to see their differences.

Categories: Linux Tags:
  1. No comments yet.
  1. No trackbacks yet.