Popular Posts

Mar 7, 2017

Solaris rsync and options

rsync and options

                 -  Rsync is a fast and extraordinarily versatile  file  copying tool.
                 -  It  can  copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon.
                 -  Rsync finds files that need to be transferred using a quick check algorithm that looks for files that have changed in size or in last-modified time.

               -v : verbose
               -r : copies data recursively (but don’t preserve timestamps and permission while transferring data
               -a : archive mode, archive mode allows copying files recursively and it also preserves symbolic links,permissions,user & group ownerships,timestamps
               -z : compress file data
               -h : human-readable, output numbers in a human-readable format

1.    Copy/Sync a File on a Local Computer
            rsync -zvh backup.tar.gz /var/tmp/backups/

2.    Copy/Sync a Directory on Local Computer
            rsync -avzh /root/rpmpkgs /var/tmp/backups/

3.    Copy/Sync a Remote Directory to a Local Machine
            rsync -avzh root@192.168.0.20:/home/tarunika/packages /var/tmp/packages

4.    Rsync Over SSH, Copy Files from Remote Server to Local Server with SSH
            rsync -avzhe ssh root@192.168.0.20:/var/adm/messages /tmp/

5.    Copy Files from Local Server to Remote Server with SSH
            rsync -avzhe ssh backup.tar.gz root@192.168.0.20:/var/tmp/backup

6.    Show the status of transfer While Transferring Data with rsync
            rsync -avzhe ssh --progress /var/packages root@192.168.0.20:/var/packages

7.    Use of –include and –exclude Options
       rsync command will include those files and directory only which starts with ‘I’ and exclude all other files and directory.
            rsync -avze ssh --include 'I*' --exclude '*' root@192.168.0.20:/var/tmp/packages/ /root/packages

8.    Use ‘–delete‘ option to delete files that is not available in source directory.
            rsync -avz --delete /var/tmp/packages root@192.168.0.20:/var/tmp/packages

9.    Automatically Delete source Files after successful Transfer
            rsync --remove-source-files -zvh backup.tar.gz /var/tmp/

10.  Do a Dry Run with rsync
       This option wont make any changes only shows what could be the result.
        If the output shows exactly what you looking for then remove ‘–dry-run‘ option run the command.
            rsync --dry-run --remove-source-files -zvh backup.tar.gz /var/tmp/



No comments:

Post a Comment

Popular Posts