Run a diff between local and remote files

ssh user@remote_host "cat remote_file.txt" | diff - local_file.txt

Source


Try:

diff local_file <(ssh user@server 'cat remote_file')

or using vimdiff:

vimdiff local_file scp://server//path/to/remote_file

Maybe this is not helpful in your exact case, but I often simply use

sum -r

on each machine, and manually compare the checksums. That allows for comparisons of files even when they are not reachable via an ssh connection. Of course, all it answers is "are they identical", but often that is sufficient for my needs. It also makes it easy to verify that a single file is the same on 3 or 4 or more machines.

Tags:

Bash

Ssh

Diff