From: Dmitry Fedotov Date: Sat, 17 Aug 2024 12:14:06 +0000 (+0300) Subject: Add rsync page. X-Git-Url: https://git.dmfe.net/?a=commitdiff_plain;h=2a1a3e887fead6140b18565c1d4260fe2770dcb0;p=dmfe-website Add rsync page. --- diff --git a/docs/unix-linux/utils/rsync.md b/docs/unix-linux/utils/rsync.md new file mode 100644 index 0000000..9a0f210 --- /dev/null +++ b/docs/unix-linux/utils/rsync.md @@ -0,0 +1,67 @@ +--- +sidebar_position: 3 +tags: + - linux + - unix + - utils + - rsync +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# rsync + +[rsync](https://rsync.samba.org/) is an open source utility that provides fast +incremental file transfer. + +## Installation + + + + ```bash + $ 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: + +```bash +$ 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 + +```bash title="Copy from local to remote host" +$ rsync source host:destination +``` + +```bash title="Copy from remote host to local" +$ rsync host:source destination +``` + +Network file transfers use the [SSH](https://wiki.archlinux.org/title/Secure_Shell) +protocol by default and `host` can be a real hostname hostname or a predefined +profile/alias from `.ssh/config`. + +### Examples + +```bash +$ 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 +