Ubuntu – How to sync files on 2 computers using an ethernet cable (offline)

ethernetsync

I have a laptop running Ubuntu 12.04 and a netbook running Ubuntu 12.10.
I want to sync some folders from my laptop on my netbook, connecting them with an ethernet cable.

Both computers are offline, and I don't want to (eventually) share files through my office LAN.

What options do I have? Can I use Unison? What do I have to do in order to "connect" the two computers? (i.e. I have to manually set IPs on them, IPv4 settings, and so on).

Best Answer

You do need to set IP addresses manually, both on netbook and notebook. The addresses must be on the same subnet.

As for the sync, you may use RSYNC over SSH to achieve this. The command is as follow:

$ rsync -avzgroupP -e ssh origin_folder login@dst_machine:destination_folder

Pay attention to the folder notation. If you add the / to the end of the directory, RSYNC will start to copy/put files from this point on but if you omit the /, then RSYNC will copy the folder itself and onward.