0

Let's say I have a lot of files in a directory that take on the following names:

FF_01_1000
FF_01_1001
FF_01_1002
.
.
.
FF_01_9999
FF_02_1000
FF_02_1001
FF_02_1002
.
.
.
FF_02_9999

Now, if I type a

cp FF

into the terminal and press tab, it will autocomplete and I will get the following:

cp FF_0

Now, if I press tab again to see what options I have, bash will show all 19998 filenames. But what if I want to know the options I have up to the first level of ambiguity, or a tab like key that gives me the following output in the terminal only:

FF_01...
FF_02...

This kind of option is very useful when it comes to navigating filenames that use dates.

  • Sorry, I'm a bit confused. Please help us help you by editing the output of echo $0 into your post. Thank you for helping us help you! – Elder Geek Mar 29 '17 at 17:24
  • I get "bash" when I type that into the terminal. – Mr. Fegur Mar 29 '17 at 17:36
  • In what way is TAB not providing "options I have up to the first level of ambiguity"? Perhaps that's the part confusing me, – Elder Geek Mar 29 '17 at 17:38
  • TAB once should complete up to the first ambiguous character - you should only get the list of files if you hit TAB again afaik... unless your bash_completion is messed up – steeldriver Mar 29 '17 at 17:50
  • TAB shows you all the files that match what you have typed. In my example, it will try to spit out 19998 filenames and then show you a --more-- output when it has filled up the screen. However, I only want some way to get it to show two outputs instead of 19998 outputs, as in the example I have posted. – Mr. Fegur Mar 29 '17 at 17:50

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.