LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to get tab auto complete in bash to scroll through all possible choices (http://www.linuxquestions.org/questions/linux-software-2/how-to-get-tab-auto-complete-in-bash-to-scroll-through-all-possible-choices-755624/)

joeldick 09-16-2009 09:11 AM

How to get tab auto complete in bash to scroll through all possible choices
 
If there are more than one possible choices, pressing <tab> twice will display them. How to I get it to scroll through each choice each time I press <tab> (like in dos)? For example, if I have:

file2
file3
file_old

then:

> fi<tab>
> file2<tab>
> file3<tab>
> file_old

Thanks.

pingu 09-16-2009 10:05 AM

Use <ctrl><r> for this.
So in terminal, press <ctrl> and <r> simoultaneously* and then type in a few letters. Press <ctrl><r> to get to next command etc.
Here is a link to a quick-sheet http://"http://www.catonmat.net/down...eat-sheet.pdf"
and a pretty handy idea:
http://www.lunix.com.au/blog/searchi...ng-and-ctrl-r/

* (Did I spell that correctly? Looks kinda weird...)

tredegar 09-16-2009 11:38 AM

pingu,
Your first link is "not found". Try this
( And it's "simultaneously" but no matter ;) )

Thanks for the "cheat sheet".

catkin 09-16-2009 12:12 PM

Interesting links but joeldick was asking about command completion, not searching command history ...

tredegar 09-16-2009 02:42 PM

Quote:

Interesting links but joeldick was asking about command completion
I know of no easy way to implement the "like in DOS" behaviour you'd like for bash completion. Maybe someone else does.

But, for the full story, see /etc/bash_completion

It's "just" a script, but that's where bash completion happens and its behaviour is defined.

It's 9400 lines for my version and is very cryptic to my eye (you'll need to be up to speed on bash awk perl & sed, to follow it, but if you'd like a different ("improved"), behaviour, this is the place to look, and tweak the code. Make a backup before you begin!

Also remember that there are many different shells you can use: zsh csh ksh ... the list goes on and on. They all offer different features. Maybe try some of them out.

Worrab 04-06-2011 04:27 PM

Windows-style auto completion for bash
 
I just discovered an easy answer on another forum. Add the following command to your .bashrc file
(or just execute it directly):

bind '"\C-i": menu-complete'


All times are GMT -5. The time now is 12:15 AM.