> For the complete documentation index, see [llms.txt](https://strangebutohwell.gitbook.io/knowledge/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://strangebutohwell.gitbook.io/knowledge/linux/file-system/file-management/rsync-command.md).

# rsync (command)

## Reference

{% embed url="<https://linux.die.net/man/1/rsync>" %}

## Syntax

### Local

rsync \[OPTION...] SRC... \[DEST]

### Access via remote shell

#### # Pull:

`rsync [OPTION...] [USER@]HOST:SRC... [DEST]`

#### # Push:

`rsync [OPTION...] SRC... [USER@]HOST:DEST`

### Access via rsync daemon

#### &#x20;Pull:

* `rsync [OPTION...] [USER@]HOST::SRC... [DEST]`
* `rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]`

#### Push:

* `rsync [OPTION...] SRC... [USER@]HOST::DEST`
* `rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST`

### Rsync Command Options

| Option | Long Option           | Description                                                                                                                                                                                                                        |
| ------ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| -a     | --archive             | archive mode; equals -rlptgoD (no -H,-A,-X)                                                                                                                                                                                        |
| -v     | --verbose             | increase verbosity                                                                                                                                                                                                                 |
| -r     | --recursive           | recurse into directories                                                                                                                                                                                                           |
| -x     | --xattrs              | preserve extended attributes                                                                                                                                                                                                       |
| -A     | --acls                | preserve ACLs (implies -p)                                                                                                                                                                                                         |
|        | --stats               | give some file-transfer stats                                                                                                                                                                                                      |
| -h     | --human-readable      | output numbers in a human-readable format                                                                                                                                                                                          |
|        | --progress            | show progress during transfer                                                                                                                                                                                                      |
|        | --info=progress2      |                                                                                                                                                                                                                                    |
| -P     |                       | same as --partial --progress                                                                                                                                                                                                       |
|        | --partial             |                                                                                                                                                                                                                                    |
| -z     | --compress            | compress file data during the transfer                                                                                                                                                                                             |
| -b     | --backup              | With this option, preexisting destination files are renamed as each file is transferred or deleted. You can control where the backup file goes and what (if any) suffix gets appended using the --backup-dir and --suffix options. |
|        | --remove-source-files | This tells rsync to remove from the sending side the files (meaning non-directories) that are a part of the transfer and have been successfully duplicated on the receiving side.                                                  |
