$ kind file1 > f1; kind file3 > f3 $ comm f1 f3 and milk duds!! grains, protein and dairy teams are fruits, greens, teams are gum, puff pastry, Children, the seven primary meals Children, the six primary meals pizza, pesticides, antibiotics,
Utilizing the cmp command
The cmp command with no further choices confirms that recordsdata are totally different and factors out the place of the primary distinction. On this case, that’s the 12th character within the first line.
$ cmp file1 file3 file1 file3 differ: byte 12, line 1 As with the diff command, there is no such thing as a output if the recordsdata have equivalent content material. $ cmp file1 file2
Utilizing the diff3 command
The diff3 command is much like the diff command, however lets you examine three recordsdata as a substitute of simply two. As well as, the formatting of the output is sort of totally different. The ====3 included within the output beneath signifies that the third file is totally different. It then reveals the variations between the primary two recordsdata and the third.
$ diff3 file1 file2 file3 ====3 1:1,3c 2:1,3c Children, the seven primary meals teams are gum, puff pastry, pizza, pesticides, antibiotics, 3:1,3c Children, the six primary meals teams are fruits, greens, grains, protein and dairy
Utilizing the sdiff command
The sdiff command compares recordsdata side-by-side. Within the first instance, you may see that the content material of each recordsdata is identical. Within the second instance, solely the final line is identical in each recordsdata and the vertical bar noting the variations within the first strains is lacking.
$ sdiff file1 file2 Children, the seven primary meals Children, the seven primary meals teams are gum, puff pastry, teams are gum, puff pastry, pizza, pesticides, antibiotics, pizza, pesticides, antibiotics, and milk duds!! and milk duds!! $ sdiff file1 file3 Children, the seven primary meals | Children, the six primary meals teams are gum, puff pastry, | teams are fruits, greens, pizza, pesticides, antibiotics, | grains, protein and dairy and milk duds!! and milk duds!!
Utilizing the colordiff command
The colordiff command shows the variations between two recordsdata just like the diff command however provides shade when the content material is totally different. The primary command beneath has no output as a result of the recordsdata are the identical. The second shows the variations between the 2 recordsdata. In your pc display screen, the font used for the primary set of strains can be pink and the second inexperienced.
$ colordiff file1 file2 $ colordiff file1 file3 1,3c1,3 < Children, the seven primary meals < teams are gum, puff pastry, < pizza, pesticides, antibiotics, --- > Children, the six primary meals > teams are fruits, greens, > grains, protein and dairy
Utilizing the wdiff command
The wdiff command shows the content material of the in contrast recordsdata (one copy) if they’re equivalent. If they’re totally different, it marks the variations utilizing sq. brackets, minus and + indicators to point their areas as within the second instance beneath.
$ wdiff file1 file2 Children, the seven primary meals teams are gum, puff pastry, pizza, pesticides, antibiotics, and milk duds!! $ wdiff file1 file3 Children, the [-seven-] {+six+} primary meals teams are [-gum, puff pastry, pizza, pesticides, antibiotics,-] {+fruits, greens, grains, protein and dairy+} and milk duds!!
Wrap-up
Don’t take the restricted instructions on this publish as which means that these instructions don’t have further choices. Use a command like wdiff –assist to get a list of the command’s choices.