How to use the colordiff command

Опубликовано: 20 Июнь 2026
на канале: InfoWorld
241
8

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!!





-----------------------------­---
SUBSCRIBE: http://www.youtube.com/subscription_c...
FACEBOOK:   / infoworld  
TWITTER:   / infoworld  
WEBSITE: http://www.infoworld.com/