How to use a different SSH port with rsync

April 18th, 2017

Warning: This post is 6 years old. Some of this information may be out of date.

I'm forever forgetting how to use a different ssh port with rsync, so here's how to do it.

    rsync -avrn --rsh='ssh -p2222' dir1 [email protected]:path/to/dir1/

There. I now have somewhere to refer to the next time I forget.