Jump to content

Recommended Posts

Posted

<div class="KonaBody"><p>Yesterday we showed you how to setup a basic <a href="http://osxdaily.com/2011/04/05/setup-ssh-config-fie/">SSH Config file</a>, and here’s how to make that even more useful: enable tab completion for those SSH aliases.</p>

<p>Throw this into ~/.bash_profile or ~/.bashrc</p>

 

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Add Tab-completion for SSH host aliases</span>

<span style="color: #7a0874; font-weight: bold;">complete</span> <span style="color: #660033;">-o</span> default <span style="color: #660033;">-o</span> nospace <span style="color: #660033;">-W</span> <span style="color: #ff0000;">"<span style="color: #007800;">$(/usr/bin/env ruby -ne 'puts $_.split(/[,s]+/)</span>[1..-1].reject{|host| host.match(/*|?/)} if <span style="color: #007800;">$_</span>.match(/^s*Hosts+/);' < <span style="color: #007800;">$HOME</span>/.ssh/config)"</span> <span style="color: #c20cb9; font-weight: bold;">scp</span> sftp <span style="color: #c20cb9; font-weight: bold;">ssh</span></pre></div></div>

 

<p>That should be on one line. Save the file, relaunch the Terminal, and now you can use tab completion with SSH aliases.</p>

<p>Thanks to Doug Schmidt for the submission!</p>

</div>

<p><a href="http://feedads.g.doubleclick.net/~a/0ZUUtwqGKGi8DQmCLiMd1QI5qAI/0/da"><img src="http://feedads.g.doubleclick.net/~a/0ZUUtwqGKGi8DQmCLiMd1QI5qAI/0/di" border="0" ismap="true"></img></a><br/>

<a href="http://feedads.g.doubleclick.net/~a/0ZUUtwqGKGi8DQmCLiMd1QI5qAI/1/da"><img src="http://feedads.g.doubleclick.net/~a/0ZUUtwqGKGi8DQmCLiMd1QI5qAI/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">

<a href="http://feeds.feedburner.com/~ff/osxdaily?a=30MFwBFr7mM:qUbeLTeYRiE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=30MFwBFr7mM:qUbeLTeYRiE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=30MFwBFr7mM:qUbeLTeYRiE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=30MFwBFr7mM:qUbeLTeYRiE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=30MFwBFr7mM:qUbeLTeYRiE:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=30MFwBFr7mM:qUbeLTeYRiE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=30MFwBFr7mM:qUbeLTeYRiE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a>

</div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/30MFwBFr7mM" height="1" width="1"/>

 

View the full article

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days


×
×
  • Create New...