How to use a different SSH port with rsync

April 18, 2017

Image for How to use a different SSH port with rsync from unsplash.com

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.