I've recently started using Mosh. It's a clever bit of software that keeps your SSH sessions running, even if your client goes offline or changes IP address.
But I find the syntax used to launch it a bit verbose and easy to forget. A typical command is something like:
mosh --ssh="ssh -p 1234" email@example.com
Within the FAQ is a fleeting mention of how to configure Mosh. It says:
Q: How do I use a different SSH port (not 22)?
As of Mosh 1.2, you can pass arguments to ssh like so:
mosh remotehost --ssh="ssh -p 2222"
Or configure a host alias in
~/.ssh/configwith a Port directive. Mosh will respect that too.
What it doesn't say is that Mosh will use all the directives in
~/.ssh/config. So you can have something like:
Host home HostName example.com User myname Port 1234
Then you can run
mosh home to connect. If you don't want to use passwords, you can add
IdentityFile ~/.ssh/example.key or similar.
Perhaps you already knew that - but I didn't.