Archive | diff RSS for this section

A More Useful Diff: OMG What Changed?!?!

So we all know diff, right? Take the following two files:

#cat first
words
thoughts
feelings

…and…

#cat second
words
thoughts
feelings

…and let’s diff them…

#diff first second
3a4
>

Well, that was useful… Wouldn’t it be nice if it’d show the files side-by-side so you could see what actually changed? Well, you’re in luck…

#diff -y -W 80 first second words words thoughts thoughts feelings feelings >

Much better, right? The only problem is that this is kind of annoying to type. There is a workaround for this though. vi your ~/.bashrc and add the following line:

alias ldiff='diff -y -W 80'

Save the file, and restart your terminal. Now we can use ldiff to diff side by side!

#ldiff first second words words thoughts thoughts feelings feelings >
%d bloggers like this: