Live data from Hacker News

BASH autocomplete for SSH

b.sricola.com

21–30 of 30 posts

Re: BASH autocomplete for SSH

#25
post #19

Zsh. It absolutely mystifies me when people get all excited about trivial enhancements to Bash, when Zsh has had those features for a decade.

Bash has had this for ages too. Debian comes with it in the "bash-completion" package, for example. People get all excited about trivial enhancements for Bash for the same reasons they don't know about Zsh: The pain isn't great enough for them to actively seek out alternatives.

So why aren't they on by default? Why is the latest Ubunbtu (styled as a user friendly Linux not a purist Linux) still making the clueless "HUH?" noise at me during tab completion because it doesn't have completion-ignore-case on by default? Or automatically showing a list of clashes or cycling through clashes instead of sitting there like a lemon? Both also one line of config somewhere.

Re: BASH autocomplete for SSH

#26
post #19

Earlier quoted context omitted.

Bash has had this for ages too. Debian comes with it in the "bash-completion" package, for example. People get all excited about trivial enhancements for Bash for the same reasons they don't know about Zsh: The pain isn't great enough for them to actively seek out alternatives.

So why aren't they on by default? Why is the latest Ubunbtu (styled as a user friendly Linux not a purist Linux) still making the clueless "HUH?" noise at me during tab completion because it doesn't have completion-ignore-case on by default? Or automatically showing a list of clashes or cycling through clashes instead of sitting there like a lemon? Both also one line of config somewhere.

Because not enough people care enough to push hard enough for it to change - presumably most of the people who do care don't find having to do apt-get install bash-completion onerous enough to matter.

Re: BASH autocomplete for SSH

#27
On the flip side a similar script to use a similar technique in .profile to strip out all SSH lines in your history would be a good security measure. That account gets compromised and you wouldn't have a road map of other hosts to connect to. Could remove known_hosts on systems that don't hash the hostnames too. Maybe I really am turning into a grumpy Sa if these are my first thoughts on reading things like this.

Re: BASH autocomplete for SSH

#28

On the flip side a similar script to use a similar technique in .profile to strip out all SSH lines in your history would be a good security measure. That account gets compromised and you wouldn't have a road map of other hosts to connect to. Could remove known_hosts on systems that don't hash the hostnames too. Maybe I really am turning into a grumpy Sa if these are my first thoughts on reading things like this.

HISTIGNORE=ssh

It won't strip existing lines, but will prevent them from being recorded in the future.

Re: BASH autocomplete for SSH

#29

On the flip side a similar script to use a similar technique in .profile to strip out all SSH lines in your history would be a good security measure. That account gets compromised and you wouldn't have a road map of other hosts to connect to. Could remove known_hosts on systems that don't hash the hostnames too. Maybe I really am turning into a grumpy Sa if these are my first thoughts on reading things like this.

HISTIGNORE=ssh It won't strip existing lines, but will prevent them from being recorded in the future.

Sorry, should be

    HISTIGNORE=ssh*
(the pattern has to match the entire line.)

Like many shell variables, this one is a colon-separated list.

Re: BASH autocomplete for SSH

#30

I have been using this trick for a while. It is annoying in two ways: first, it includes misspelled hosts. Second, it does not work for scp and sftp. Otherwise, it may save you time.

> it does not work for scp and sftp

The .ssh/config tip does work though. I'd rather have them there anyway since I can give the host an alias.

  Host myproxy
  HostName xxxxxxx.xxx
  User xxxx
  Port xxxx
and ssh will autocomplete on my
Post reply on HN