Last Updated: February 25, 2016
·
2.553K
· lixef

OSX ssh config hostname autocompletion

If you're using a ssh config for storing your hostnames, OSX doesn't provide an auto completion.

Store this in your .bashprofile:
complete -o default -o nospace -W "$(/usr/bin/env ruby -ne 'puts $
.split(/[,\s]+/)[1..-1].reject{|host| host.match(/*|\?/)} if $_.match(/^\s*Host\s+/);' < $HOME/.ssh/config)" scp sftp ssh

source: http://hints.macworld.com/article.php?story=20100113142633883