News for hackers. Stuff that matters.
Re:BASH autocomplete for SSH by jack83 on Saturday January 21, 2012 @02:59AM (#3492954)
you can also use ctrl+R
Re:BASH autocomplete for SSH by 6ren on Saturday January 21, 2012 @03:18AM (#3492981)
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 by 6ren on Saturday January 21, 2012 @05:34AM (#3493255)
EDIT [missed the edit window] whoops, I see ctrl-r is "reverse-search-history" (not "history-search-backward"), it matches your input to any part of the history (so the prefix issue doesn't arise). So you could just type the hostname, and it will pick out the most recent line in the history that matches - it needn't be at the beginning of the line. You can hit ctrl-r again to go to a matching line further up.

ctrl-s goes back down again, but not working for me, apparently because my gnome terminal intercepts it before bash's readline sees it, using it for xon/xoff according to http://stackoverflow.com/questions/791765/unable-to-forward-... This "fixes" it (by disabling the STOP feature of the terminal), so ctrl-s works to search down.

  stty -ixon
Re:BASH autocomplete for SSH by daniellockard on Saturday January 21, 2012 @03:03AM (#3492956)
You'd be surprised how little some people know about bash ctrl commands.
Re:BASH autocomplete for SSH by snprbob86 on Saturday January 21, 2012 @03:56AM (#3493057)
Honestly, simply reading `man bash` from start to finish was one of the best things I ever did. I started doing it with all sorts of stuff. May I suggest you start with `man man`?

Then someone told me about `apropos` which is summarized in it's man page as "search the whatis database for strings". Sooo useful. Not nearly as useful as simply reading man pages from start to finish, but I've only got so much spare time.

Re:BASH autocomplete for SSH by agumonkey on Saturday January 21, 2012 @04:53AM (#3493184)
Reading `man` is the kind of thing you understand after years of hitting hard walls. Even now I still despise it even though I know most of the answers are in it. I think I want something less linear to search into, oh and I'm surely a lazy P*S too.
Re:BASH autocomplete for SSH by dmhouse on Saturday January 21, 2012 @05:53AM (#3493280)
I think `man readline' is more appropriate for the keyboard shortcuts, since it is the readline library that provides many of them.
Re:BASH autocomplete for SSH by agumonkey on Saturday January 21, 2012 @03:11AM (#3492968)
generalize to gnu/linux tools.
Re:BASH autocomplete for SSH by xenomachina on Saturday January 21, 2012 @03:32AM (#3493010)
generalize to things they use every day
Re:BASH autocomplete for SSH by dredmorbius on Saturday January 21, 2012 @05:13AM (#3493224)
generalize to things