17

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.

6
  • 16
    probably <TAB> completion
    – mikeserv
    Dec 4, 2014 at 15:37
  • 8
    Yep, hit Tab twice in a row at a bash prompt, you'll see that. Dec 4, 2014 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, 2014 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, 2014 at 8:10
  • 1
    Thanks. This happened to me when try to copy paste a script into the terminal with TABS instead of SPACES. Jul 11, 2019 at 20:09

6 Answers 6

27

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.

17

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.

4
  • 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. Dec 4, 2014 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, 2014 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. Dec 4, 2014 at 22:53
  • True. complete -E -c did the trick ;)
    – Matías
    Dec 4, 2014 at 23:08
7

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

2

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)

1

By pressing Esc key thrice, will display this message.

3
  • 2
    That's not correct. What three ESC are supposed to do?
    – dr_
    Aug 3, 2015 at 7:14
  • I just mentioned what i noticed. Nothing else to say.
    – F.A Khan
    Nov 21, 2015 at 12:36
  • that's unusual, but indeed hitting ESC three times shows Display all 2588 possibilities? on Windows10 using git bash Jan 30, 2017 at 13:00
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.

You must log in to answer this question.

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