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 [email protected]:/home/admin' /home/admin

it doesn’t work saying:

diff: ssh [email protected]:/home/admin: No such file or directory

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

Thanks in advance


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:

diff <(ssh [email protected] ls -R /home/admin) <(ls -R /home/admin)

Answered By – BMW

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published