Rsync: The powerful network copy tool

rsync is a small, light weight, easy to use linux command line tool which can transfer N number of files from source to destination over any kind of network. Especially when copying files over limited bandwidth, rsync is much faster and reliable.

rsync is basically used for two filesystem/directory tree synchronization which are placed in two different network locations. It also can be used for website mirroring.

Here find some simple example usages of rsync :

1. Copying/syncing the contents of one directory called “/src” to another directory called “/dst” :

rsync -a /src/ /dst

Note: “-a” option represents archive mode, which preserves most of the file attributes when copying.

If you miss a trailing slash (/) after source directory, it will create the directory as “/dst/src” in the destination and will transfer the files into it.

2. Copying the contents of a directory called “/src” in computer 1 to another directory called “/dst” in computer 2 :

rsync -a -e ssh /src/ computer2:/dst

Assume you are in computer 1, you can execute the above command to copy files to computer 2 using “ssh”. It will establish an ssh connection from computer 1 to computer 2 and transfer files over that connection. Also, it will ask you ssh login details on computer 2 to establish the connection before start transferring the data.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>