Remote diff over ssh

Want to do a diff on a local and remote file, or on 2 remote files.

Here is a small trick

# Local and remote diff
 diff file <(ssh remote 'cat file')

# Or both are on remote servers
diff <(ssh remote1 'cat file') <(ssh remote2 'cat file')

I use this a lot when a ansible –check run tells me there is a diff and want to know what I will be overwriting.

Cloud & Open-Source magician 🧙‍♂️

I try to find the KISS in complex systems and share it with the world.

comments powered by Disqus