------------------------------------------------------------------------------------- / _ \ \_\(_)/_/ _//"\\_ JOHLEM.net / \ https://johlem.net/V1/topics/cheatsheet.php ------------------------------------------------------------------------------------- --- Rsync Cheatsheet #install Rsync sudo apt install rsync #backup.tar needs to be copied or synced to /tmp/backups/ folder. rsync -zvh backup.tar /tmp/backups/ #/root/rpmpkgs contains some rpm package files and you want that directory to be copied inside /tmp/backups/ folder. rsync -avzh /root/rpmpkgs /tmp/backups/ #Copy a Directory from Local Server to a Remote Server #in your local computer “rpmpkgs” which contains some RPM packages and you want that local directory’s content send to a remote server sync -avz rpmpkgs/ root@192.168.0.101:/home/ #Copy/Sync a Remote Directory to a Local Machine #Here in this example, a directory /home/toto/rpmpkgs which is on a remote server is being copied in your local computer in /tmp/myrpms. rsync -avzh root@192.168.0.100:/home/toto/rpmpkgs /tmp/myrpms #Copy a File from a Remote Server to a Local Server with SSH #o specify a protocol with rsync you need to give “-e” option with protocol name you want to use. Here in this example, We will be using “ssh” with “-e” option and perform data transfer. rsync -avzhe ssh root@192.168.2.100:/root/install.log /tmp/