Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I just learned that if you hit and hold ESC while on the Mac Terminal, a prompt appears after a few seconds offering to show every command available on your system, including aliases, built-ins, and executables on your PATH.

Soruce: http://www.mactricksandtips.com/2008/05/list-all-possible-terminal-commands.html

However, the output is show through a more filter, and I cannot grep it or pipe it to another command.

Does anyone know how this magic output is generated? Is it just generated on the fly by Terminal? Is there a bash command that can be called explicitly on the command line and get the same result?

It is mostly curiosity, but I would love to be able to get the results as text I can post-process and not just browse on screen.

share|improve this question
    
Retagged because it's a bash feature. –  Ignacio Vazquez-Abrams Jun 14 '10 at 6:55
    
Great, thanks. That's a start: at least now I know it is not Terminal.app but bash the one who does the trick. –  Sergio Acosta Jun 14 '10 at 7:23
1  
Related: superuser.com/questions/58201/… –  Chris Johnsen Jun 14 '10 at 8:35
1  
Just press Esc twice at an empty prompt - no need to hold it down. –  Dennis Williamson Jun 14 '10 at 10:35

1 Answer 1

up vote 2 down vote accepted

As Ignacio Vazquez-Abrams commented, this functionality comes from the bash completion feature. The compgen built-in command provides access to the functionality.

You can access the command completion like this:

# all commands
compgen -c
# command starting with "ls"
compgen -c ls
share|improve this answer
    
Wow, much better. Thanks a lot! –  Sergio Acosta Jun 14 '10 at 17:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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