1 |
rsync options source destination |
- -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, file permissions, user & group ownerships and timestamps
- -z : compress file data
- -h : human-readable, output numbers in a human-readable format
Copy/Sync Files and Directory Locally
1 |
rsync -zvh backup.tar /tmp/backups/ |
1 |
rsync -avzh /root/rpmpkgs /tmp/backups/ |
Copy a Directory from Local Server to a Remote Server
1 |
rsync -avz rpmpkgs/ root@192.168.0.101:/home/ |
1 |
rsync -avzh root@192.168.0.100:/home/tarunika/rpmpkgs /tmp/myrpms |
Rsync Over SSH
1 |
rsync -avzhe ssh root@192.168.0.100:/root/install.log /tmp/ |
1 |
rsync -avzhe ssh backup.tar root@192.168.0.100:/backups/ |
Show Progress While Transferring Data with rsync
1 |
rsync -avzhe ssh --progress /home/rpmpkgs root@192.168.0.100:/root/rpmpkgs |
Automatically Delete source Files after successful Transfer
1 |
rsync --remove-source-files -zvh backup.tar /tmp/backups/ |