Skip to content

Instantly share code, notes, and snippets.

@PercussiveRepair
Created July 14, 2015 08:04
Show Gist options
  • Save PercussiveRepair/bbe018d948d46bce236e to your computer and use it in GitHub Desktop.
Save PercussiveRepair/bbe018d948d46bce236e to your computer and use it in GitHub Desktop.
.ssh/config autocomplete
perl -ne 'print "$1 " if /^Host (.+)$/' ~/.ssh/config
# ssh autocomplete based on ~/.ssh/config
# I use this in my bashrc to expand hosts defined in ~/.ssh/config:
function _ssh_completion() {
perl -ne 'print "$1 " if /^Host (.+)$/' ~/.ssh/config
}
complete -W "$(_ssh_completion)" ssh
# Here's a great article on how to setup your own ~/.ssh/config:
# http://blogs.perl.org/users/smylers/2011/08/ssh-productivity-tips.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment