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.

- Stein van Broekhoven


comments powered by Disqus