commands.sh

compgen

all

Bash built-in command for generating possible completion matches in Bash. Usually used within custom completion functions. See also: `complete`, `compopt`.

More info →

Examples (8)

List all shell built-ins, aliases, functions, and executables that you could run

List all commands that you could run that start with a specified string and save results to `$COMPREPLY`

compgen -V COMPREPLY -c str

Match against a wordlist

compgen -W "apple orange banana" a

List all aliases

List all functions that you could run

Show shell reserved keywords

See all available commands/aliases starting with `ls`

List all users on the system

made by @shridhargupta | data from tldr-pages