//View Tip #381
Similar Tips
» bzip2 ssh copy and machine power off
» Connect your mic to a remote speaker
» Comparing local and remote files
» Using ssh as a generic stdin consumer and stdout producer

 

Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
tab completion is something we use all day long. put this into your .bash_profile. You can use tabs to auto complete the hostname for ssh calls.

complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh


View Comments »




Comments 

Add your comment

Comments are currently disabled
Mike
Quite nice indeed. This did show the powers of bash's completion abilities very nicely. Very good tip
Posted 2008-10-16 12:20:22
Jeremy Cantrell
The latest version of openssh will not allow you to read hostnames from the known_hosts file.
Posted 2008-10-16 13:56:19
Kris Marsh
New OpenSSH versions hash known hosts by default yes (to stop worm from parsing the known_host file and harvesting hostnames).

To disable this, modify /etc/ssh/ssh_config, and set:
   HashKnownHosts no
Posted 2008-10-24 20:38:41

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit