2

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.

  • 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. – okysabeni Apr 25 '11 at 14:14
1

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.

  • 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. – okysabeni 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

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