Tools for Linux sysadmins #3: sdiff

Many Linux sysadmins have in common that working with configuration and other text files is part of their daily work. In my case, I often migrate older Linux boxes to our own Ubuntu fork. Therefore it is required to also use old configurations where it makes sense. When configuring and testing the applications on the new target server, such as CUPS or Samba, it is very useful to diff the old configuration against the new one.

Many use the tool diff for that purpose, since it is preinstalled on most Linux systems and is also very easy to use.

diff for lazy sysadmins: sdiff!
But one of the disadvantages of diff is that its output might be difficult to read sometimes. Even when combining diff with colordiff (e.g. diff file1 file2 |colordiff) you still need to concentrate yourself and put some effort in reading the lines.

This is where sdiff comes in. Like htop brings some overview advantage over top, sdiff does the same with diff.
Simply try it!

sdiff another_list installed_packages |less
sdiff example output in less
sdiff example output in less

As you can see, sdiff compares both files within two text columns, putting empty space between them. This makes sdiff’s output very easy to read.
Of course sdiff knows some options to improve the diffing process and output – simply call –help to learn more.