2 ms·
If you add the following to your .bash_profile, you'll get command line completion of your hosts: function _ssh_completion() { perl -ne 'print "$1 " if /
by swalberg 14y ago
If you add the following to your .bash_profile, you'll get command line completion of your hosts:
function _ssh_completion() {
perl -ne 'print "$1 " if /^[Hh]ost (.+)$/' ~/.ssh/config
}
complete -W "$(_ssh_completion)" ssh
- jperras 14y agoI use ZSH, which if configured properly will also do this for you. Huge timesaver when I need to connect to a half-dozen hosts.
- paxswill 14y agoThe standard bash_completion[0] package includes SSH host completion. [0] http://bash-completion.alioth.debian.org/ http://bash-completion.alioth.debian.org/