Thursday, January 22, 2009
Diff remote files using ssh in Linux
I have already discussed how we can edit a remote file using vi and scp in one of my previous post ; today we will see how we can find or show differences between a local file and a remote file using ssh.
Suppose we have to find the differences between local file "/tmp/filepurge.sh.old" and remote file "/root/scripts/filepurge.sh" located in remote host 172.21.16.11.
This is how can do it:
$ ssh root@172.21.16.11 "cat ~/scripts/filepurge.sh" | diff - /tmp/filepurge.sh.old
And using vimdiff:
$ vimdiff scp://root@172.21.16.11//root/scripts/filepurge.sh /tmp/filepurge.sh.old
** We would need ssh to work using public key authentication so that we can do remote commands execution without being prompted for passwords.
Labels:
Bash,
bash shell,
bash shell newbie,
Linux Commands,
linux diff,
SSH
Subscribe to:
Post Comments (Atom)
© Jadu Saikia www.UNIXCL.com
3 comments:
Thank you! That tip came in very handy today.
Hi Jadu,
I have few experienced with ssh from linux to unix. I want to know if I would do same from linux to windows, for example I want to send command to windows (dir, ipconfig, del, ren ...)
Sincerely
Could I do same from linux to Windows, such as send command del, ipconfig, ren ...
Post a Comment