UNISON File Synchronizer can be used to perform bi-directional sync between two directories (local or remote)

Installation:

CentOS:

UNISON file synchronizer can be install through yum by the below command

yum install unison -y

Note: Make sure that you have EPEL repository installed/enabled on the server

Debian/Ubuntu:

apt-get install unison

Configuration/Syntax:

Synchronizing Local Directories:

unison -batch /path/to/directory1  /path/to/directory2

Local to Remote Synchronization:

unison -batch /path/to/local/directory ssh://remote.server.com///path/to/remote/directory

Note: Make sure that the both the servers are configured with Key Based SSH Authentication to avoid password prompts during sync..