Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anshprat/683e732a9bad4558d8d3ab89a9d07dc6 to your computer and use it in GitHub Desktop.
Save anshprat/683e732a9bad4558d8d3ab89a9d07dc6 to your computer and use it in GitHub Desktop.
Bash AutoComplete from known_hosts
# add to ~/.bash_profile, and close/reopen a shell. Will autocomplete any hosts found in known_hosts.
complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment