Americas

  • United States

How to use the colordiff command

Overview

In this Linux tip, we’re going to look at the colordiff command. It displays the differences between two files like the diff command, but adds color whenever the content is different. This first command has no output because the files are the same. $ colordiff file1 file2 Now let’s compare two files with a difference. $ colordiff file1 file3 1,3c1,3 Kids, the seven basic food a groups are gum, puff pastry, pizza, pesticides, antibiotics, --- Kids, the six basic food groups are fruits, vegetables, grains, protein and dairy Notice how the colors highlight the differences between the two files. Here’s the full content of file3 showing the only line the files share (line 4). $ cat file3 Kids, the six basic food groups are fruits, vegetables, grains, protein and dairy and milk duds!!

Register Now