Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

At work, I often have to log into hosts which follow a common naming scheme, e.g. qc01 - qc12, hc01 - hc10, and so on. All of these need to get the same config values in my laptop's .ssh/config. Of course, I could use entries for the hosts qc* and hc*, but I'm wondering if instead it is somehow possible to use regular expressions?

share|improve this question
up vote 7 down vote accepted

As gelraen stated default ssh_config won't support regular expressions but you can try something different like :

share|improve this answer

Please, see PATTERNS section in man ssh_config.

Long answer is: No, you can't, unless you patch your ssh to support that.

share|improve this answer
I cannot find this section in my man ssh_config. – Patryk Jan 23 '13 at 13:55
try linux.die.net/man/5/ssh_config – gelraen Jan 23 '13 at 13:56
What version did that appear? – vonbrand Jan 26 '13 at 7:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.