sysadmin at bitly. wannabe entrepreneur. logical thinker. avid traveller. mostly human with a few friends. cheese.
drop me a line sriumd [at] gmail [dot] com

sricola blogs too

un-popularly known as srivatsa viswanathan

  • RSS
  • About

bash autocomplete for SSH

If you are like me, and you SSH to machines through out the day, you want this. Ok. You __need__ this.

The following one liner, parses your .bash_history file and attempts to autocomplete the host you are trying to SSH to. Add this line to your .bash_profile/.bashrc file.

complete -W "$(echo $(grep '^ssh ' .bash_history | sort -u | sed 's/^ssh //'))" ssh

Of course the lookup is limited to machines you have already SSH’d to. But whatevs, it __will__ save you time and keystrokes. Time which you could use to watch re-runs of My Little Pony.

Jan 20 2012
Comments 24 notes
  • #autocomplete
  • #bash
  • #linux
  • #ssh
  • #oneliner
  1. developed6ok liked this
  2. emileeyou89 liked this
  3. jankowskihi6 liked this
  4. stelabouras liked this
  5. benryyip liked this
  6. 2citizen liked this
  7. kyhikari liked this
  8. sjaeckel liked this
  9. kiwihead reblogged this from sriblogstoo
  10. jacob liked this
  11. matiskay liked this
  12. whereshallwehavelunch liked this
  13. gsiener liked this
  14. parkeyparker liked this
  15. ambivalens liked this
  16. nickthejam liked this
  17. omgmog reblogged this from sriblogstoo
  18. cderivan reblogged this from sriblogstoo
  19. sriblogstoo posted this
Copyright © 2012