BASH autocomplete for SSH
b.sricola.com
BASH autocomplete for SSH
1–10 of 30 posts
Re: BASH autocomplete for SSH
#2you can also use ctrl+R
Re: BASH autocomplete for SSH
#3you can also use ctrl+R
You'd be surprised how little some people know about bash ctrl commands.
Re: BASH autocomplete for SSH
#4Re: BASH autocomplete for SSH
#5you can also use ctrl+R
I bind this to up-arrow in my .inputrc:
"\e[A": history-search-backward
"\e[B": history-search-forward
OP's method would be helpful when the line differs syntactically prior to the hostname e.g. different options, arguments, a pipe into it. Though that case is rare in my own usage.Re: BASH autocomplete for SSH
#6Two more places to extract hostnames for ssh auto completion are .ssh/known_hosts and the .ssh/config.
Or give zsh a try, simply autoload compinit and it will do ssh/sftp auto completions along with a boatload more out of the box.
Re: BASH autocomplete for SSH
#7Re: BASH autocomplete for SSH
#8bash_completion does this for most systems. Its also available in mac ports
Re: BASH autocomplete for SSH
#9Two more places to extract hostnames for ssh auto completion are .ssh/known_hosts and the .ssh/config. Or give zsh a try, simply autoload compinit and it will do ssh/sftp auto completions along with a boatload more out of the box.
Ian MacDonald's bash completions (http://www.caliban.org/bash/) do this with known_hosts.
Re: BASH autocomplete for SSH
#10Two more places to extract hostnames for ssh auto completion are .ssh/known_hosts and the .ssh/config. Or give zsh a try, simply autoload compinit and it will do ssh/sftp auto completions along with a boatload more out of the box.
I usually set up my SSH autocompletes to read from known_hosts. The problem is that on some systems, like say Debian, the hostnames are hashed for security reasons. So you have to add the following line to your .ssh/config to get the hostnames back into a readable form.
HashKnownHosts no