compgen
Generate possible completion matches for word according to the options.[1]
Documentation
- compgen [EN] @ GNU Bash Reference Manual
- bash -c 'help compgen'
- man 1 'bash' [EN]
Syntax
compgen [PARAMETER ...] FILTER
Parameters
- -A ACTION
- The ACTION may be one of the following to generate a list of possible completions:
- alias
- Alias names. May also be specified as -a.
- builtin
- Names of shell builtin commands. May also be specified as -b.
- command
- Command names. May also be specified as -c.
- export
- Names of exported shell variables. May also be specified as -e.
- function
- Names of shell functions.
- variable
- Names of all shell variables. May also be specified as -v.
Examples
- List all commands starting with 'ls'
compgen -A 'command' 'ls'
Output:
lscpu
lsattr
lslocks
...
References
- ↑ man 1 'bash'