cheatsheets/rsync.md

96 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

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
# syncing folder src into dest:
2017-08-29 21:52:27 +00:00
rsync -avz ./src /dest
# 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
--partial # allows resuming of aborted syncs
--bwlimit=RATE # limit socket I/O bandwidth
2017-08-29 21:52:27 +00:00
```
### Display options
```bash
-q, --quiet
-v, --verbose
--stats
2017-08-29 21:52:27 +00:00
-h, --human-readable
--progress
-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
-D # same as --devices --specials
2017-08-29 21:52:27 +00:00
```
```bash
--delete # Delete extra files
```