About Rsync:
Rsync is a utility for efficiently transferring and synchronizing files across computer systems, by checking the timestamp and size of files.[3] It is commonly found on Unix-like systems and functions as both a file synchronization and file transfer program. The rsync algorithm is a type of delta encoding, and is used for minimizing network usage. Zlib may be used for additional data compression,[3] and SSH or stunnel can be used for data security.
Rsync is typically used for synchronizing files and directories between two different systems. For example, if the command rsync local-file user@remote-host:remote-file is run, rsync will use SSH to connect as user to remote-host.[4] Once connected, it will invoke the remote host’s rsync and then the two programs will determine what parts of the file need to be transferred over the connection.
Installing Rsync:
For Yum
yum install rsync
For Debian / Ubuntu
apt-get install rsync
Command:
$ rsync [options] source-path destination-path
Options:
-z, --compress
-n, --dry-run
-q, --quiet
-v, --verbose
-h, --human-readable
-P, --progress
-b, --backup
-u, --update # skip files newer on dest
-c, --checksum # skip based on checksum, not mod-time & size
-a, --archive # archive (-rlptgoD)-r, --recursive
-l, --links # copy symlinks as links
-p, --perms # preserve permissions
-t, --times # preserve times
-g, --group # preserve group
-o, --owner # preserve owner
-D # --devices --specials--delete # Delete extra files
--exclude # Exclude log/tmp folders etc
A complete command would look like:
$ rsync -avzP — exclude={tmp,.git} -e “ssh -i /Users/miradnan/Downloads/key.pem” ubuntu@172.168.1.1:/var/www/html/my-application /var/www/html/my-application