Created
May 31, 2026 07:20
-
-
Save ivan/1872bad8e7102a40aeb7c4ccc3805bef to your computer and use it in GitHub Desktop.
rsync tips
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rsync -av -@-1 as the baseline thing | |
| or with --delete to remove things from DEST, and probably | |
| --delete-excluded when using --exclude | |
| rsync -@-1 compares timestamps by nanoseconds instead of seconds, which is important for transferring e.g. PostgreSQL data; rsync doesn't read the data inside each file if the (mtime, size) matches on both ends, unless you: | |
| rsync -c | |
| rsync -X to also copy xattrs (slower) | |
| rsync -H for hard link preservation (uses memory to track all the inodes) | |
| rsync -S to preserve sparseness in sparse file | |
| rsync --zc=zstd | |
| rsync --zc=zstd --compress-level=6 or maybe 8 where the link is slow and extra compression is useful | |
| rsync --progress | |
| rsync --dry-run | |
| rsync --remove-source-files, in the rare cases you want that | |
| rsync --append when transferring only append-only logs | |
| rsync --inplace if you need to be able to resume unfinished transfers; also generally faster with many files, avoiding renames | |
| rsync --delete-before when copying to a DEST that might run out of space if the deletes aren't done first | |
| rsync -e "ssh -o ..." if you need to control SSH stuff, like | |
| rsync -e "ssh -o Compression=no" which may increase throughput with data that doesn't compress | |
| rsync --bwlimit=RATE | |
| rsync --chmod=u+w, to make writable read-only files in e.g. `.git/` | |
| It doesn't have good built-in parallelism, but you can do e.g. | |
| ``` | |
| rsync -a SRC1 DEST1 & | |
| rsync -a SRC2 DEST2 & | |
| wait | |
| ``` | |
| A trailing slash on SRC e.g. SRC/ puts SRC/* rather than SRC into DEST. | |
| The path in rsync user@host:path starts in HOME. | |
| With unstable SRC data, rsync twice or thrice or until it doesn't find any more changes. | |
| Browsers and Electron things should probably be closed before rsync'ing their profiles. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment