💾 Archived View for darknesscode.xyz › notes › rsync-command.gmi captured on 2024-02-05 at 09:41:01. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-05)

-=-=-=-=-=-=-

Rsync Command to transfer and sync data to remote or host machines

rsync -- a fast, versatile, remote (and local) file-copying tool

Install Rsync

Arch Linux

sudo pacman -S rsync

Debian

sudo apt install rsync

Void Linux

sudo xbps-install rsync

Rsync is in most/all Linux distros repositories

Syntax

Local to Local:  rsync [OPTION]... [SRC]... DEST
Local to Remote: rsync [OPTION]... [SRC]... [USER@]HOST:DEST
Remote to Local: rsync [OPTION]... [USER@]HOST:SRC... [DEST]

Examples

Copy all file in the Documents directory to an external ubs ssd/hhd in a local host

rsync -a ~/Documents/* /mnt/backup

Every time the command runs will copy/transfers only the new data or data that has been updated in the documents directory

Copy files in a local host to and external ssd/hdd usb

rsync -azP ~/Music/* user@xxx.xxx.xxx.xxx:~/Music

To copy/update a website in a remote server

rsync -azP ~/Documents/web/public/* user@domain.xxx:/var/www/domain.xxx

To copy/update a backup from a remote server

rsync -azP user@damain.xxx:/var/www/domain.xxx/* ~/Documents/backupweb

You can use and ip address or a domanin name with srync command, if the directory do not exist in the destination host rsync will create the directory

Rsync use ssh protocol to connect to a remote host, if the remote host is listenling on different port (22)

rsync -azP -e "ssh -p 2343" ~/Documents/web/public/* user@domain.xxx:/var/www/domain.xxx

For more info and options, man rsync

----------

Home

Linux

Notes

MicroLog

----------

© DarknessCode