Skip to main content

rsync

rsync is an open source utility that provides fast incremental file transfer.

Installation

$ sudo pacman -S rsync

Usage

As cp/mv alternative

rsync can be used as an advanced alternative for the cp or mv command, especially for copying larger files:

$ rsync -P source destination

the -P option is the same as --partial --progress, which keeps partially transferred files and shows a progress bar. You may want to use the -r/--recursive option to recurse into directories.

Copy between remote hosts

Copy from local to remote host
$ rsync source host:destination
Copy from remote host to local
$ rsync host:source destination

Network file transfers use the SSH protocol by default and host can be a real hostname hostname or a predefined profile/alias from .ssh/config.

Examples

$ rsync -uvrP --delete-after ~/website/ root@remote-host:/var/www/website/

-u/--update - skip files that are newer on the receiver
-v/--verbose - increase verbosity
-r/--recursive - recurse into directories
-P/--partial -- progress- keeps partially transferred files and shows a progress bar
--delete-after - receiver deletes after transfer, not during