rsync for SCP swappers

Since the Openssh release 8.0 it is discouraged to use the scp tool further. This is taken from the release notes:

Security
========
...
The scp protocol is outdated, inflexible and not readily fixed. We
recomusernd the use of more modern protocols like sftp and rsync for
file transfer instead.
...

While scp usage is easy, rsync will be easy too, because the syntax needed for basic tasks is identical. For example copying local file text.txt to target system user home dir:

user % rsync text.txt user@target:/home/user/

Copying recursive a local directory to target system user home dir:

user % rsync -r dir/ user@target:/home/user/

Using the –archive (-a for short) option for copying a directories recursive and preserving most of its content:

user % rsync -a dir/ user@target:/home/user/

The rsync man page has a explanation of the --archive option:

       --archive, -a
          This is equivalent to -rlptgoD.  It is a quick way of saying you want recursion and want to preserve  al‐
          most  everything (with -H being a notable omission).  The only exception to the above equivalence is when
          --files-from is specified, in which case -r is not implied.

          Note that -a does not preserve hardlinks, because finding multiply-linked files is expensive.   You  must
          separately specify -H.

If the target node runs SSH server on a different TCP port f.e. 2222, using the rsync -e command specify a “local binary” command to use. Use the -e flag, in example the dbclient SSH client is used:

user % rsync -e 'dbclient -p 2222' text.txt user@target:/home/user/

dbclient is the SSH client of the dropbear SSH suite.

With these examples shown the move from scp to rsync should not be that far away anymore.