~/.ssh/config — your terminal command center
The ~/.ssh/config file is where SSH stops being a verb and starts being a habit. Instead of typing long flag soup every time, you define named hosts with all their settings — port, user, key, ProxyJump, you name it — and reference them by alias. ssh office instead of ssh -p 2222 -i ~/.ssh/id_ed25519_office you_username@192.168.1.100.
How precedence works
SSH resolves settings in this order (first match wins for each setting):
- Command-line flags —
-p 2222overrides everything below. - ~/.ssh/config — your personal client config.
- /etc/ssh/ssh_config — system-wide defaults.
- OpenSSH built-in defaults.
Within a config file, the first matching Host block wins for each setting. That's why specific entries go above general ones, and Host * goes at the bottom.
The format
It's an indented ini-style file. Comments start with #. Indentation is conventional, not required — SSH parses it just fine without indentation, but indented blocks are far easier to read.