Autocomplete SSH HostsMike Griffin
Once upon a long time ago, I had autocomplete set up in ZSH to complete hosts that I connected to through SSH. Only in the last few days have I set it up again in bash.
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2 | tr ' ' '\n')" scp sftp ssh
complete is a bash builtin function, which you can read more about in this TheGeekStuff article.
This line will add the hosts in your
~/.ssh/config file to the autocomplete list for