Set Host Aliases in ~/.ssh/config with HostName
Give a server a short name in ~/.ssh/config with Host and HostName. A name that matches no Host block is not an error: ssh treats it as a host name.
You log in to the same server several times a day and the user, port and address are too long to type.
cat > cfg <<'EOF'
Host db
HostName 10.0.0.5
User deploy
Port 2222
EOF
ssh -F cfg -G db | grep -E '^(hostname|user|port) '
echo ---
ssh -F cfg -G dbx | grep -E '^(hostname|user|port) 'user deploy
hostname 10.0.0.5
port 2222
---
user root
hostname dbx
port 22A Host line starts a block of settings that apply when the name you type matches one of its patterns, and HostName is the real address to connect to, as in the ssh_config manual. ssh -G resolves the configuration without connecting. The first answer shows the alias expanded. The second shows a typo: no block matches dbx, so ssh keeps it as the host name, with the local user and port 22, and the failure arrives later as a DNS error or a prompt for the wrong account.
Check an alias with ssh -G before relying on it. The file is read once per connection, in order, and the first value found for each option wins, which matters as soon as a second block matches the same name. Use a space or an equals sign between a keyword and its value, and keep the indentation consistent so the blocks stay readable.