Flash Notes
Files - Differences between two remote files
• How is it possible to display the differences between two files across different servers ?
Solution
diff local_file <$(ssh remote_server "cat remote_file_pathname")
or :
ssh remote_server "cat remote_file_pathname" | diff local_file -
or :
ssh remote_server "cat remote_file_pathname" | diff local_file -
Example 1
$ diff /etc/hosts <(ssh srv2 "cat /etc/hosts")
Example 2
$ ssh srv2 "cat /etc/hosts" | diff /etc/hosts -