linuxshell

How to diff directories over ssh


I am trying to recursively compare a directory in the local host to a directory in a remote linux machine. However, when i execute the next command:

diff -r 'ssh admin@10.0.0.10:/home/admin' /home/admin

it doesn't work saying:

diff: ssh admin@10.0.0.10:/home/admin: No such file or directory

what is the right way to compare recursively the directories contents?

Thanks in advance


Solution

  • If you needn't diff the detail in file, just get the difference of dir/file name, then try this:

    (Note: need set "SSH login without password", for detail, review this URL: http://www.linuxproblem.org/art_9.html)

    diff <(ssh admin@10.0.0.10 ls -R /home/admin) <(ls -R /home/admin)