So you've probably got one or two hosts that you frequently ssh to that have long hostnames. You'd prefer to just alias this to something really short. There's a couple ways to do this:
- Hosts file alias. Problem: may overwrite something useful for other network connections.
- Shell alias. Problem: too many aliases.
- Good shell tab-completion. Problem: I can never get zsh to do intelligent ssh host completion.
- SSH configured alias.
So to create an alias for a system add to ~/.ssh/config the following:
Host <alias>
HostName <real system fqdn>
Some examples:
Host s
HostName scottr.org
Host b
HostName 192.168.1.1
After a Host entry can be host specific configuration, and Host can be a pattern (Host *.slashdot.org). So for a host you could disable host key checking, or use a specific key file. Comes in pretty handy.
Host s
HostName scottr.org
Port 2222


Wow, great tip -- much better than shell aliases. Especially helpful for differing usernames for specific hosts, since I could never get zsh to autocomplete usernames. Thanks!
You can also add the keyword Port and a non-standard port number as follows: