Rsync with a custom port

18th Mar 2022

You can rsync with a different port by adding -e "ssh --port" into the rsync command.

Here’s what it looks like:

rsync -avz -e "ssh --port" source [email protected]:/destination

-e specifies a remote shell to use. In this case, we set it to ssh. Once we set it to ssh, we can use other flags that come with ssh.

-avz are other flags I commonly use for rsync. They stand for archive, verbose, and compress.

  • -a — archive mode. This is complex since it equals to -rlptgoD. Basically this does lots of improvements to make it easier to copy folders recursively.
  • -v — verbose. It lets me see which files are transferred.
  • -z — compress. This makes the transfer faster by compressing data.

That’s it!

If you enjoyed this article, please support me by sharing this article Twitter or buying me a coffee 😉. If you spot a typo, I’d appreciate if you can correct it on GitHub. Thank you!

Hold on while i sign you up…

🤗
Woohoo! You’re in!
Now, hold on while I redirect you.