CLI, diff, and something like meld
If you work with remote machines, and you need to take a brief look at some changes in files it might be really painful.
If need a quick glimpse into differences between two files, you can always use diff.
diff file_a.txt file_b.txt 3c3 < It's alive! --- > And his name will be forty and four.
you can even get some context, together with difference
diff -u file_a.txt file_b.txt --- file_a.txt 2018-10-26 11:28:40.000000000 +0200 +++ file_b.txt 2018-10-26 11:28:40.000000000 +0200 @@ -1,3 +1,3 @@ Hello world! -It's alive! +And his name will be forty and four.
But, let’s be honest, that’s not what regular developers want to see. I know there are people who are extraordinary.
– I wanna tell you my secret now
– OK
– I see dead people
However, for most of us, seeing things as they are, visually, where you can actually see the difference served on the plate in front of you, is a sort of warm place where we feel comforted. And, what’s more important, you can have it, while working with CLI.
First of all, you can always resort to Vim. Yes, old good Vim can provide you with visualization of differences.
> vim -d file_a.txt file_b.txt
Second approach, is to use dedicated tool called: ydiff
All you have to do, is to download it from GitHub.
> curl -ksSL https://raw.github.com/ymattw/ydiff/master/ydiff.py > ~/bin/ydiff > chmod +x ~/bin/ydiff
and pass outcome of diff directly to ydiff.
> diff -u file_a.txt file_b.txt | ~/bin/ydiff -s
And what is your preferred way of checking differences while working with CLI?