Quick Linux Tip #49:
Try: diff <(ssh linuxteck@server1 cat /etc/nginx/nginx.conf) <(ssh linuxteck@server2 cat /etc/nginx/nginx.conf)
Info: Process substitution <() combined with SSH pipes file contents directly to diff. No temp files needed. Great for verifying config parity across servers.
Examples:
- $ diff <(ssh s1 'rpm -qa | sort') <(ssh s2 'rpm -qa | sort')
- $ diff <(ssh s1 'systemctl list-units --state=running') <(ssh s2 'systemctl list-units --state=running')
- $ colordiff <(ssh s1 cat /etc/hosts) <(ssh s2 cat /etc/hosts)
Note: Requires SSH key authentication to avoid password prompts. Use with ControlMaster (Tip #16) for speed. colordiff makes the output much easier to read.
Leave a Reply