Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Beyond compare remote with local file

I want to compare two text files one on remote the other local. With diff I would do that with

ssh user@login "cat myfile.txt" | diff - local.txt

Is there a way to perform the same comparison using Beyond Compare? If I do

ssh user@login "cat myfile.txt" | bcompare - local.txt

I get only the local file displayed.

like image 694
Manfredo Avatar asked Jun 06 '17 09:06

Manfredo


People also ask

How do I connect to beyond compare server?

To connect to the bridge in Beyond Compare, open the FTP url ftp://localhost/ or ftp://127.0.0.1/ . If you configured the bridge to run on an alternate port, specify the port using the syntax ftp://localhost:#/ , where # is the alternate port.


2 Answers

One neat trick that I use in such cases is to use sshfs to make the remote directory appear as a local one to beyond compare:

sshfs user@host:/opt/data /tmp/transfer

Then you can use any diffing tool to compare your local data with the remote one via diff -Nur /local/data/dir /tmp/transfer or with beyond compare as usual and you can copy files back and forth as needed.

Note, you might need to install sshfs via your package manager, e.g. on Debian/Ubuntu via apt-get install sshfs

Possible options:

  • -o PubkeyAuthentication=no: If you need password authentication, but ssh first tries too many private key authenticaitions, not needed if you use private key auth for this server or no private key auth at all
  • -o sshfs_debug: Print out more information if authentication/connection fails
  • -o idmap=user: Use the idmap=user option to translate the UID of the connecting user to the remote user
  • -o gid=1000: uid, gid - set reported ownership of files to given values; uid is the numeric user ID of your user, gid is the numeric group ID of your user.
  • -o nomap=error: Fail if user mapping cannot be done

See https://wiki.archlinux.org/index.php/SSHFS for more details.

like image 198
centic Avatar answered Sep 30 '22 14:09

centic


Beyond Compare Pro includes built-in SFTP support, so you can pass an SFTP URL directly to it as a command-line argument.

bcompare local.txt sftp://user:password@server/folder/file.txt

If you don't provide a password in the URL, Beyond Compare will prompt you for a password.

bcompare local.txt sftp://user@server/folder/file.txt
like image 32
Chris Kennedy Avatar answered Sep 30 '22 12:09

Chris Kennedy