How do I diff files/folders across machines provided that the only connectivity available is ssh?
|
You can do it with Bash's process substitution:
Or, if both are on remote servers:
|
|||||||||||||||||
|
|
Finally I've found great solution: vimdiff
thanks to http://linux.spiney.org/remote_diff_with_vim_and_ssh see also http://www.vim.org/scripts/script.php?script_id=1075 . |
|||
|
|
|
If you just want to see what files are different, rather than a diff of the actual files, then you can use |
|||||||
|
|
Use scp to bring the files to a common machine and diff them there? Or, if you just want to know if the files are different or not, hash them with md5sum on each machine. You could also look into something like SSHFS, but I don't know how well an algorithm like diff performs over that. |
|||||
|
|
Here's another quick and dirty command line recipe: ssh [login]@[host] "cat [remote file]" | diff - "[local file]" |
|||
|
|
|
One way, if it is possible on your system would be to simply mount the remote filesystem with sshfs. |
|||
|
|
Here is how I did it. I used SFTP to the remote server and entered my username/pwd when prompted. Then I used the dir that was created in the .gvfs dir in my home directory in the diff command. diff -r --brief /home/user dir/.gvfs/SFTP\ on\ freenas.local/path to dir/dir1 /path to local dir/dir2 |
|||
|
|
|
This is a script that can help to diff local folder and remote folder.:
|
||||
|
|
|
http://myfedora.co.za/2012/04/diff-two-remote-file-systems/ diff <(/usr/bin/ssh user1@192.168.122.1 'ls /opt/lib/') <(/usr/bin/ssh user2@192.168.122.1 'ls /tmp/') | grep -i ">" | sed 's/> //g' |
|||
|
|
|
|||
|
|
rsync -ani --delete / root@remotehost:/but the full answer gives more detail. – Owen Blacker Feb 14 '12 at 18:30