OPENRSYNC(1)

πŸ“¦
version 2025-01 Β· 2 versions
, in nixos 26.05

πŸ’– OPENRSYNC(1) πŸ’–

okay so this is openrsync, from the General Commands Manual bestie, and we're about to synchronise local and remote files like it's nothing ✨


🌸 NAME 🌸

openrsync β€” synchronise local and remote files πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

openrsync [-aDgIJlnOoprtVvx] [-e program] [--address=sourceaddr]
          [--compare-dest=directory] [--contimeout=seconds] [--del]
          [--exclude pattern] [--exclude-from=file] [--include pattern]
          [--include-from=file] [--max-size=size] [--min-size=size]
          [--no-motd] [--numeric-ids] [--port=service]
          [--rsync-path=program] [--size-only] [--timeout=seconds]
          source ... directory

✨ DESCRIPTION ✨

so the way this works πŸ’… β€” openrsync makes the files in the destination directory match up with one or more source files. The glow-up, basically.

Either the source or the destination directory may be remote, but not both. That's the rule, no cap πŸ™…

The arguments are as follows:

🌈 OPTIONS 🌈

  • -a, --archive β€” the iconic shorthand, literally just -Dgloprt bundled up πŸŽ€
  • --address=sourceaddr β€” when you're connecting to an rsync daemon, use sourceaddr as the source address for the connections. Super handy on machines with multiple interfaces, iykyk πŸ¦‹
  • --compare-dest=directory β€” use directory as an alternate base directory to compare files against, on the destination machine. If a file in directory is found and it's identical to the sender's file, the file just won't be transferred β€” saving you that bandwidth, periodt. Multiple --compare-dest directories may be provided. If directory is a relative path, it's relative to the destination directory. 🫢
  • --contimeout=seconds β€” set the connection timeout, in seconds. Exit if no connection gets established within the specified time. The default is 0, which means no timeout at all ⏳
  • -D β€” also transfer device and special files. Shorthand for --devices --specials πŸ‘‘
  • --del, --delete β€” delete files in directory that aren't found in the source directories. Only applicable with -r ⚠️ (yes, it deletes. be so for real before you run it πŸ’€)
  • -e program, --rsh=program β€” specify an alternative communication program. Defaults to ssh(1) πŸ”
  • --exclude pattern β€” exclude files matching pattern πŸ™ˆ
  • --exclude-from=file β€” load patterns and rules from file πŸ“
  • --devices β€” also transfer device files 🧚
  • -g, --group β€” set the group name to match the source. Example time bestie: group "kristaps" with ID 1000 on a remote server gets matched to group "kristaps" on the local machine with ID 2000. But if --numeric-ids is also given, or if the remote group name is unknown on the local machine, set the numeric group ID to match the source instead πŸ’–
  • -I, --ignore-times β€” do not skip based on file size and modification time πŸ‘€
  • --include pattern β€” include files matching pattern ⭐
  • --include-from=file β€” load patterns and rules from file 🌸
  • -J, --omit-link-times β€” don't set symlink modification times to match the source πŸ¦‹
  • -l, --links β€” also transfer symbolic links. The link is transferred as a standalone file: if the destination doesn't exist, it will be broken 😭 (we love a standalone queen but she's fragile)
  • --max-size size β€” don't transfer any file larger than size bytes. Alternatively, size may instead use a multiplier, as documented in scan_scaled(3), to specify the size πŸ“
  • --min-size size β€” don't transfer any file smaller than size bytes. See --max-size for the definition of size πŸ“
  • -n, --dry-run β€” do not actually modify the destination. Mainly useful in combination with -v πŸ” (vibe check first, always)
  • --no-motd β€” do not display the Message of the Day πŸ™…β€β™€οΈ
  • --numeric-ids β€” ignore user and group names, use numeric user and group IDs only. Has no effect unless -g or -o is also given. ⚠️
  • -O, --omit-dir-times β€” don't set directory modification times to match the source πŸŽ€
  • -o, --owner β€” set the user name to match the source, with similar matching logic as for -g. If --numeric-ids is also given, or if the remote user name is unknown on the local machine, set the numeric user ID to match the source instead. Only works if run as root πŸ‘‘πŸ”₯
  • -p, --perms β€” set destination file or directory permissions to match the source when it's updated πŸ›‘οΈ
  • --port=service β€” specify an alternative TCP port number. The service can be given as a decimal integer or as a name to be looked up in the services(5) database. The default is "rsync" πŸ”Œ
  • -r, --recursive β€” if source designates a directory, synchronise the directory and the entire subtree connected at that point. If source ends with a slash, only the subtree is synchronised, not the source directory itself. If source is a file, this has no effect 🌳 (the slash matters, bestie, don't play with it)
  • --rsync-path=program β€” run program on the remote host instead of the default rsync πŸš€
  • --size-only β€” skip files based only on size, don't check timestamp ⏱️
  • --specials β€” also transfer fifo and unix domain socket files πŸ§šβ€β™€οΈ
  • --timeout=seconds β€” set the I/O timeout in seconds. Exit if no data was transferred for the specified time. The default is 0, which means no timeout πŸ’€
  • -t, --times β€” set destination file and directory modification time to match the source when it's updated or created πŸ•°οΈ
  • -V, --version β€” print version and exit πŸ‘‹
  • -v, --verbose β€” increase verbosity. Specify once for files being transferred, twice for specific status, thrice for per-file transfer information, and four times for per-file breakdowns πŸ—£οΈπŸ—£οΈπŸ—£οΈπŸ—£οΈ
  • -x β€” do not cross filesystem boundaries. If this option is repeated, all mount point directories from the copy are omitted. Otherwise, it includes an empty directory at each mount point it encounters 🚧

okay now the ✨lore✨ about remote paths, because this is where people get confused:

A remote source or directory has the syntax host:path for connecting via ssh(1), or rsync://host/path or host::path for connecting to a remote daemon. Subsequent to the first remote source, the host may be dropped to become just :path or ::path 🌐

For connecting to a remote daemon with rsync://host or host::path, the first path component is interpreted as a "module": host::module/path. This only applies to the first source invocation; subsequent to that, the module should not be specified ⚠️

By default, new destination files and directories are given the current time and the source file permissions. Updated files retain their existing permissions. It is an error if updated files have their file types change (e.g., updating a directory with a file) πŸ’€

At this time, source may only consist of regular files, directories (only with -r), or symbolic links (only with -l). The destination directory must be a directory and is created if not found 🫢


πŸ”₯ EXIT STATUS πŸ”₯

  • 0 β€” success, slay πŸ’…
  • 1 β€” an error occurred 😭
  • 2 β€” the remote protocol version is older than the local protocol version πŸ’€

🌈 EXAMPLES 🌈

A common invocation of openrsync is for archiving from a remote host to the local computer:

% openrsync -av --delete remote:rpath /local/path

This will update the contents of /local/path/rpath with those on the remote server. Switching remote and local will update the remote contents instead:

% openrsync -av --delete /local/path remote:rpath
ngl all examples use -t so that destination files inherit the source time. If not changed, subsequent invocations of openrsync will then consider the file up to date and not transfer block hashes ✨

To update the out-of-date remote files host:dest/bar and host:dest/baz with the local ../src/bar and ../src/baz:

% openrsync -t ../src/bar ../src/baz host:dest

To update the out-of-date local files bar and baz with the remote files host:src/bar and host:src/baz:

% openrsync -t host:src/bar :src/baz .

To update the out-of-date local files ../dest/bar and ../dest/baz with bar and baz:

% openrsync -t bar baz ../dest

To update the out-of-date remote files in host:dest on a remote host running openrsync with the local host running rsync(1):

% rsync --rsync-path openrsync -t ../dest/* host:dest

πŸ‘€ SEE ALSO πŸ‘€

ssh(1)


πŸ“œ STANDARDS πŸ“œ

openrsync is compatible with rsync protocol version 27 as supported by the samba.org implementation of rsync 🀝


πŸ¦‹ HISTORY πŸ¦‹

The openrsync utility has been available since OpenBSD 6.5 πŸŽ€


πŸ‘‘ AUTHORS πŸ‘‘

The openrsync utility was written by Kristaps Dzonsons <kristaps@bsd.lv> πŸ’–


and that's the whole page bestie!! this one came from Debian, dated $Mdocdate$, and it's OPENRSYNC(1) all the way down 🫢✨ go forth and synchronise responsibly, mwah πŸ’…

πŸ“¦ where this page comes from