diff: find differences of two files in remote machines

Scenario: we have two files in two remote servers and we want to find differences between them without copying files etc, the servers are server1 and server2, the filename is common on both servers and its name is file.txt


  • I assume that you have SSH connectivity on both server1 and server2

How to do it:

$ diff <(ssh user@server1 'cat /usr/local/files/file1.txt') <(ssh user@server2 'cat /usr/local/files/file1.txt')

I hope you found the article useful :)

Written by

DevOps engineer, loves Linux, Python, cats and Amiga computers

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store