diff over ssh

auditory의 이미지


네트웍으로 연결된 두 서버간에 diff를 써서 같은지
다른지 확인할 수 있는 방법이 있을까요?

diff 자체로는 ssh는 지원하지 않는것 같고,
rsync로는 그냥 변경점을 보기만 하는 옵션은 못찾겠고,
unison이 있다던데, 이것도 사용이 좀 번거롭네요.

현재는 sshfs로 한쪽에서 마운트해서, diff를 써서 하고 있는데,
마운트하지 않고 직접 비교할 수 있는 방법이 있을까요?

cinsk의 이미지

Host sarah와 host plora가 있고, 각각 src/hello.c가 있다고 가정.

sarah$ # sarah:src/hello.c와 plora:src/hello.c를 비교
sarah$ ssh plora "cat src/hello.c" | diff -c src/hello.c -
 
sarah$ # sarah에서 plora의 hello.c와 hi.c를 비교
sarah$ ssh plora "cd src; diff -c hello.c hi.c"

--
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Korean Ver: http://www.cinsk.org/cfaqs/