SUPPORT THE SITE WITH A CLICK

Subscribe Rss:

SUPPORT THE SITE WITH A CLICK

Tuesday, April 28, 2009

Remote Diff in linux

Basically we will be using the diff command to compare between the files, but if we want to compare between two remote servers.Then we have use the diff command in a different format like this

ssh <remote-host> "cat /path/to/remotefile" | diff - /path/to/localfile


For example
gen@lostwarrior:~/Mypace/base/layout$ ssh gen@genlinux.org "cat /home/genlinux/base/layout/base.txt" | diff - /home/gen/base/layout/base.txt

Here
  1. gen@genlinux.org is the remote server
  2. /home/genlinux/base/layout/base.txt is the remote file
  3. /home/gen/base/layout/base.txt is the local file

1 comment :

  1. How about a recursive diff for a directory tree? Any ideas?

    ReplyDelete