Tag Archives: Hosts

SSH completion

I hate it when I need to type the entire host I want to connect to. So I’ve added this to my ~/.bash_profile which autocompletes the ssh command based on my ~/.ssh/config

complete -W “$(awk ‘/^\s*Host\s*/ { sub(/^\s*Host /, “”); print; }’ ~/.ssh/config)” ssh

Thanks to @janmoesen for fixing the error.