22

I use autocomplete a lot in the terminal, like for example for cp command. But sometimes, when I am putting in the directory for the cp command and I press Tab, the list of files is so long that Ubuntu spits out part of the list and then waits for key input before sequentially listing the rest of the files, one by one. This feature is near useless because you never know how many files are left, and almost always end up with an error.

Is there some way to leave this list and go back to my cp command, or do I have to press Ctrl+C and start typing in my cp command again?

muru
  • 193,181
  • 53
  • 473
  • 722
Mr. Fegur
  • 325
  • 1
  • 2
  • 7
  • @David Bash's tab completion doesn't use a pager. The readline library does this. It just uses the most common pager's keybindings. – muru Oct 02 '17 at 09:48

2 Answers2

35

You can type in the Q key. ...

Luís de Sousa
  • 13,018
  • 25
  • 77
  • 128
saiarcot895
  • 10,727
  • 2
  • 35
  • 39
4

This doesn't directly answer your question (@saiarco895 did that), but I hate the default behavior of tab-completion in bash for the same reason. Assuming you're using Bash, you can change the behavior of the readline library it uses by editing the ~/.inputrc file. I put the following in it:

set menu-complete-display-prefix On
"\CTAB": possible-completions
TAB: menu-complete
"\x1b[Z": menu-complete-backward

which allows me to cycle through completion options without printing them out using tab and shift-tab. If I need to see a print-out of all options, I use alt-shift-?

Cookyt
  • 141
  • 1