Last Updated: February 25, 2016
· filipekiss
1900150 10203074354438338 1015529188 n

Auto Complete SSH Hosts

I had this for so long on my .zshrc file that I don't know what I'd do without it... A friend of mine once told me about this and I thought I could share with you guys. And don't worry. It's not zsh only. Works with almost any shell

Just paste the code below on your rc file (.zshrc, .bashrc... They're usually on your $HOME)

complete -o default -o nospace -W “$(awk ‘/^Host / {print $2}’ < $HOME/.ssh/config) scp sftp SSH

You'll need to use a config file to list your hosts (you can read more about it here), but that's pretty much it :)

Say Thanks

1 Response
Add your response


This doesn't seem to work .. also, you've got smart quotes in there, so that might be part of the problem.

over 1 year ago ·
Filed Under

Awesome Job

B6c77ad0 c95b 11e7 8263 8f89080b8db6
Ruby Developer Backend
Austria (Vienna or Linz)
Full Time