I’m lazy and I’m always looking for ways to avoid any unneeded typing. Here’s a little OpenSSH configuration tip that can save you up to 16 characters (if you have crazy long usernames).
When your local username doesn’t match the one on the remote server, do you find yourself routinely typing something like:
What if I told you that you could reduce it to just:
Edit, creating if need be,
~/.ssh/config and add a rule like:
The rule is pretty much as it seems, when connecting to host
ec2-user for the remote username.
Host line allows multiple hostnames and has limited wildcard
support, allowing rules like:
Bonus, this laziness leads to even greater laziness, the stock Bash
SSH completion helper will Tab-complete a bare hostnames matching
those it finds in
~/.ssh/known_hosts, but not one that starts starts
with a username.
What will you do with all the key strokes you save?