Improving my Linux diff experience with icdiff


I recently came across icdiff. This little gem allows you to see the difference between two files, but what makes it special is its ability to highlight the differences (sdiff, which was my go to diff tool, doesn’t have this feature):

$ icdiff --cols 80 -U 1 -N node_groups.tf node_groups_new.tf

node_groups.tf                          node_groups_new.tf                     
      10     # `depends_on` causes a re       10     # `depends_on` causes a re
fresh on every run so is usele          fresh on every run so is usele         
ss here.                                ss here.                               
      11     # [Re]creating or removing       11     # [Re]creating or removing
 these resources will trigger            these resources will trigger          
recreation of Node Group resou          recreation of Node Group resou         
rces                                    rces ***something***                   
      12     aws_auth         = coalesc       12     aws_auth         = coalesc
elist(kubernetes_config_map.aw          elist(kubernetes_config_map.aw         
s_auth[*].id, [""])[0]                  s_auth[*].id, [""])[0]    

In the example above, icdiff highlighted the keyword “something” on line 11 in column 2. I really dig the highlighting, and its ability to print X lines before and after the match. You can also define the output column size which is helpful when you are working on the command line.

This article was posted by on 2020-07-07 00:00:00 -0500 -0500