Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I have a folder with several files on my computer, and a copy of the same folder on a remote server, is it possible to run 'diff' through ssh so I can see the differences between my copy and the one on the remote server? Ideally, I'd like to see if there are any additional/less files in either copy of the folder and then check to see if the individual files themselves have any differences.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

To see if there are any additional/less files in either copy of the folder

diff -y <(ssh user@remote_server 'ls -1aR /remote_folder/') <(ls -1aR /local_folder/)
share|improve this answer

diff only works with local files. You might use scp or rsync to copy the files to a local directory and compare it with diff, or you can use something like sshfs to mount a remote directory to a local one and compare it with the second one.

For a single file, you can use ssh and diff:

ssh user@machine cat remote-file | diff - local.file
share|improve this answer
    
Is there no ssh equivalent of diff? This would work... but it seems to me that someone else would have wanted the same thing, and hopefully done it. :P Thanks, though! –  Kitchi Oct 29 '12 at 12:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.