Skip to content

Instantly share code, notes, and snippets.

@aliang
aliang / Mac SSH Autocomplete
Created Jun 14, 2011
Add auto complete to your ssh, put into your .bash_profile
View Mac SSH Autocomplete
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
You can’t perform that action at this time.