2013-10-14 02:36:58 +00:00
|
|
|
---
|
2013-03-25 17:44:24 +00:00
|
|
|
title: Rsync
|
2015-11-24 05:06:06 +00:00
|
|
|
category: CLI
|
2017-08-29 21:53:45 +00:00
|
|
|
weight: -1
|
2013-10-14 02:36:58 +00:00
|
|
|
---
|
2013-03-25 17:44:24 +00:00
|
|
|
|
2017-08-29 21:52:27 +00:00
|
|
|
### Basic example
|
|
|
|
{: .-prime}
|
2014-06-14 02:26:51 +00:00
|
|
|
|
2017-08-29 21:52:27 +00:00
|
|
|
```bash
|
2018-11-07 21:23:17 +00:00
|
|
|
# syncing folder src into dest:
|
2017-08-29 21:52:27 +00:00
|
|
|
rsync -avz ./src /dest
|
2018-11-07 21:23:17 +00:00
|
|
|
# syncing the content of src into dest:
|
|
|
|
rsync -avz ./src/ /dest
|
2017-08-29 21:52:27 +00:00
|
|
|
```
|
2014-02-25 10:32:14 +00:00
|
|
|
|
2017-08-29 21:52:27 +00:00
|
|
|
### OSX
|
2014-02-25 10:32:14 +00:00
|
|
|
|
2017-08-29 21:52:27 +00:00
|
|
|
```bash
|
|
|
|
--exclude '.Trashes'
|
|
|
|
--exclude '.Spotlight-V100'
|
|
|
|
--exclude '.fseventsd'
|
|
|
|
```
|
|
|
|
|
|
|
|
### Transfer options
|
|
|
|
|
|
|
|
```bash
|
|
|
|
-z, --compress
|
|
|
|
-n, --dry-run
|
2018-11-07 21:23:17 +00:00
|
|
|
--partial # allows resuming of aborted syncs
|
2019-08-05 18:28:26 +00:00
|
|
|
--bwlimit=RATE # limit socket I/O bandwidth
|
2017-08-29 21:52:27 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Display options
|
|
|
|
|
|
|
|
```bash
|
|
|
|
-q, --quiet
|
|
|
|
-v, --verbose
|
2019-08-05 18:23:45 +00:00
|
|
|
--stats
|
2017-08-29 21:52:27 +00:00
|
|
|
-h, --human-readable
|
|
|
|
--progress
|
2018-11-07 21:23:17 +00:00
|
|
|
-P # same as --partial --progress
|
2017-08-29 21:52:27 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Skipping options
|
|
|
|
|
|
|
|
```bash
|
|
|
|
-u, --update # skip files newer on dest
|
|
|
|
-c, --checksum # skip based on checksum, not mod-time & size
|
|
|
|
```
|
|
|
|
|
|
|
|
### Backup options
|
|
|
|
|
|
|
|
```bash
|
|
|
|
-b, --backup # backup with suffix
|
|
|
|
--suffix=SUFFIX # default ~ without --backup-dir
|
|
|
|
--backup-dir=DIR
|
|
|
|
```
|
|
|
|
|
|
|
|
### Include options
|
|
|
|
|
|
|
|
```bash
|
|
|
|
--exclude=PATTERN
|
|
|
|
--include=PATTERN
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
--exclude-from=FILE
|
|
|
|
--include-from=FILE
|
2018-11-20 06:18:50 +00:00
|
|
|
--files-from=FILE # read list of filenames from FILE
|
2017-08-29 21:52:27 +00:00
|
|
|
```
|
|
|
|
|
2020-03-05 11:03:52 +00:00
|
|
|
```bash
|
|
|
|
-C, --cvs-exclude # exclude from local/global .cvsignore
|
|
|
|
```
|
|
|
|
|
2017-08-29 21:52:27 +00:00
|
|
|
### Archive options
|
|
|
|
|
|
|
|
```bash
|
|
|
|
-a, --archive # archive (-rlptgoD)
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
-r, --recursive
|
|
|
|
-l, --links # copy symlinks as links
|
|
|
|
-p, --perms # preserve permissions
|
|
|
|
-t, --times # preserve times
|
|
|
|
-g, --group # preserve group
|
|
|
|
-o, --owner # preserve owner
|
2021-02-19 05:57:24 +00:00
|
|
|
-D # same as --devices --specials
|
2017-08-29 21:52:27 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
--delete # Delete extra files
|
|
|
|
```
|