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?

1
  • @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 2, 2017 at 9:48

2 Answers 2

35

You can type in the Q key. ...

1
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-?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .