Home » 2014 » February » 27 » RSYNC : A command in linux to copy files remotely. Faster and more flexible than rcp

5:35 PM
RSYNC : A command in linux to copy files remotely. Faster and more flexible than rcp

Share on Google+

The command is same like rcp but  can be used for large and faster file transfer from one machine to another.

FORMAT:
       rsync [OPTION]... SRC [SRC]... DEST

       rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST

       rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST

       rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST

       rsync [OPTION]... SRC

       rsync [OPTION]... [USER@]HOST:SRC [DEST]

       rsync [OPTION]... [USER@]HOST::SRC [DEST]

       rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]


DESCRIPTION
       rsync is a program that behaves in much the same way that rcp does, but has many more options and uses the rsync remote-update protocol to greatly speed up file transfers when the destination file is being updated.
       The rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network connection, using an efficient checksum-search algorithm described in the technical report that accompanies this package.

 Some of the additional features of rsync are:
 
  • support for copying links, devices, owners, groups, and permissions
     
  • exclude and exclude-from options similar to GNU tar
     
  • a CVS exclude mode for ignoring the same files that CVS would ignore
     
  • can use any transparent remote shell, including ssh or rsh
     
  • does not require super-user privileges
     
  • pipelining of file transfers to minimize latency costs
     
  • support for anonymous or authenticated rsync daemons (ideal for mirroring)

Perhaps the best way to explain the syntax is with some examples:

 

 rsync -t *.c server1:src/

                    This will transfer all files matching the pattern *.c from the current directory to the directory src on the machine  server1. If  any of the files already exist on the remote system then the rsync remote-update protocol is used to update the file by sending only the differences. See the tech report for details.

Note:  rsync remote-update protocol does a checksum of fileslices against a local copy to reduce the traffic.

-t: preserve modification time of file

rsync -avzun foo:src/bar /data/tmp

                     This would recursively transfer all files from the directory src/bar on the machine foo into the /data/tmp/ directory on the  local  machine.  The  files are transferred in "archive" mode, which ensures that symbolic links, devices, attributes, permissions, ownerships, etc. are preserved in the transfer.  Additionally, compression will be used to reduce the size  of data portions of the transfer.

-a: --archive                archive mode 

-v: --verbose               verbose mode,     increase verbosity.

-z:  --compress           compress file data during the transfer

-u: --update                skip files that are newer on the receiver than on the sender side.

-n, --dry-run               perform a trial run with no changes made, only used to perform a trial.

Note:- If you run this command using "-n" option, it wont make any changes. It will just perform a trial run. So, next time run the same command without "-n" option.

rsync -avz foo:src/bar/ /data/tmp

                    A  trailing  slash  on the source changes this behavior to avoid creating an additional directory level at the destination. You can think of a trailing / on a source as meaning "copy the contents of this directory" as opposed to "copy  the  directory  by name", but in both cases the attributes of the containing directory are transferred to the containing directory on the destination.  In other words, each of the following commands copies the files in the same way, including their  setting of the attributes of /dest/foo:

 rsync -av /src/foo /dest
rsync -av /src/foo/ /dest/foo

            
       

 
 

Category: Open System-Linux | Views: 2677 | Added by: shanky | Tags: file tranfer from one machine to an, rsync, rcp | Rating: 0.0/0

Related blogs


You may also like to see:


[2015-01-18][Open System-Linux]
The JAR archiving tool in Linux
[2014-11-19][Open System-Linux]
ETHTOOL : A tool in Linux to display or change ethernet card setting
[2014-12-28][Open System-Linux]
Shift command with examples
[2016-05-24][Open System-Linux]
FACTER command in Linux : showing system facts
[2014-02-19][Open System-Linux]
Shift Key is not working!! Mapping keyboard keys from one to another

Total comments: 0
ComForm">
avatar