Possible Duplicate:
Is there a way to make bash more TAB friendly?

Suppose we have 2 files in a folder called:

  1. 1010123_file1
  2. 1010456_file2

In the Mac OS X Terminal, when I tab twice, it lists me both files and instantly puts "1010" for me. is there anyway to choose the individual files using the keyboard. the up button pulls up previous commands.

I have many files with a naming convention of <timestamp>_filename and it's annoying to have to look after the leading characters.

link|improve this question

75% accept rate
You can use the keyboard and press either 1 or 4, then press Tab again. – Daniel Beck Apr 22 '11 at 16:25
@daniel beck. I don't understand. Suppose i am in a folder with 100 files named file_number_one all the way to file_number_hundred. I type f and hit tab twice, it will auto puts me at file_number_ and then i want to be able to select between "one" or "hundred" to select the file. I am not pressing 1 or 4 does anything. – Yko Apr 25 '11 at 14:14
feedback

closed as exact duplicate by Ignacio Vazquez-Abrams, Majenko, Sathya Apr 23 '11 at 3:44

This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.

1 Answer

Add

TAB: menu-complete

to your ~/.inputrc file. That will cause the tab-completion in BASH to rotate between all possible completions:

http://cnswww.cns.cwru.edu/php/chet/readline/rluserman.html#SEC19

Be sure to "source ~/.inputrc" or start a new shell to apply the config.

link|improve this answer
I do not want to lose the capability of displaying all files when I hit "tab" twice. This looks like it will do that. I want to be able to see the files but the use a different command to select a particular file. – Yko Apr 25 '11 at 14:12
You can bind menu-complete to something other than TAB; maybe Ctrl-Tab? – idleyoungman Apr 25 '11 at 20:29
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.