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 :)
Written by Filipe Kiss
Related protips
1 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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#