Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to diff directories over ssh

Tags:

linux

shell

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

like image 864
Hesham Yassin Avatar asked Jan 07 '14 10:01

Hesham Yassin


People also ask

Can you Diff two directories?

Using Meld Visual Diff and Merge Tool Click on directory comparison and move to the next interface. Select the directories you want to compare, note that you can add a third directory by checking the option “3-way Comparison”. Once you selected the directories, click on “Compare”.

How do I compare two directories in differences?

Click on the “Select Files or Folders” tab in the far left, to start a new comparison. Each comparison you run opens in a new tab. To start a new comparison, click on the “Select Files or Folders” tab in the far left, change the targets and click “Compare” again.


1 Answers

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 [email protected] ls -R /home/admin) <(ls -R /home/admin) 
like image 184
BMW Avatar answered Oct 01 '22 11:10

BMW