15

So, I was moving my laptop around (and I have the bad habit of setting things on the keyboard...) and I woke up to discover this:

$
Display all 2588 possibilities? (y or n)

What command would display something like this?

I'm using Bash.

  • 15
    probably <TAB> completion – mikeserv Dec 4 '14 at 15:37
  • 8
    Yep, hit Tab twice in a row at a bash prompt, you'll see that. – glenn jackman Dec 4 '14 at 15:37
  • 5
    You should somewhat abandon that bad habit. This time, it was just tab completion, next time it's your business critical report that undergoes subtle but critical changes. See it like this: As a carpenter, you wouldn't put something on the buzz saw. – phresnel Dec 5 '14 at 11:18
  • Yeah, I don't run anything that is/has money on my unix. Just information that I like collecting. Notes to myself, little scripts, programming doodads. Nothing of interest or real import. If all you have is scrap-wood, you don't care if the buzzsaw eats it. – user3082 Dec 25 '14 at 8:10
  • Thanks. This happened to me when try to copy paste a script into the terminal with TABS instead of SPACES. – Benjamin Jul 11 at 20:09
21

Hitting TAB key helps you to auto complete either a command or a file/directory (as long as it is executable) you want to use, depending on what you are requesting.

Double hitting the TAB key helps you displaying the available stuff you could use for next.

e.g.

Command completition:

I want to edit my crontab. Typing cront and hitting TAB then I will see my command complete: crontab.

File/Directory completition:

I want to backup my crontab. crontab -l >> Type some words of the destination /ho TAB then I will see: /home/, type next us TAB then I will see: /home/user/

Now, when you double hit TAB key without typing something, then the prompt expects something, so it will want to help you displaying all the possibilities. With the prompt empty, it's expecting a command or a file/directory so it will want to display all the commands available for you & all the files/directories located in the directory where you are.

The 2588 possibilities output, means the total amount of commands/files/directories available to type.

16

That will happen when hitting space key (invisible) and then TAB key twice (bash completion). The 2588 possibilities to display are likely the files/directories on your current working directory when hitting the space + bash completion key combination.

  • 8
    Or, the executable files in the path, if this was at the beginning of a line. This would explain why there are so many. – Emil Jeřábek Dec 4 '14 at 18:02
  • I did a test, reproducing the command, and then setting PATH="", export PATH and trying again and result it's the same. Just the files at $PWD – Matías Dec 4 '14 at 22:35
  • 2
    Do it without the space, right at the beginning of the line. Whether it will actually work depends on shell settings: if nothing happens, try complete -E -c first. – Emil Jeřábek Dec 4 '14 at 22:53
  • True. complete -E -c did the trick ;) – Matías Dec 4 '14 at 23:08
7

Tapping TAB two or more times in a row will show you that.

1

I use tab completion all the time to save on typing. Totally didn't think about it's use when I wasn't completing a command string.

"\t" gets a bell

" \t" gets a bell

" \t\t" gets a directory list

"\t\t" gets the Display all possibilities (and then if I hit "\t" after that on a new commandline, I'll get it again instead of a bell)

0

According to https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html

When word completion is attempted for an argument to a command for which a completion specification (a compspec) has been defined using the complete builtin (see Programmable Completion Builtins), the programmable completion facilities are invoked.

-2

By pressing Esc key thrice, will display this message.

  • 2
    That's not correct. What three ESC are supposed to do? – dr01 Aug 3 '15 at 7:14
  • I just mentioned what i noticed. Nothing else to say. – F.A Khan Nov 21 '15 at 12:36
  • that's unusual, but indeed hitting ESC three times shows Display all 2588 possibilities? on Windows10 using git bash – Max Koretskyi aka Wizard Jan 30 '17 at 13:00

Your Answer

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

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