2018-03-31 17:51:22 +08:00
|
|
|
# compgen
|
|
|
|
|
2025-03-09 03:23:24 +02:00
|
|
|
> A built-in command for auto-completion in Bash, which is called on pressing `<Tab>` key twice.
|
2021-07-09 16:45:55 +02:00
|
|
|
> More information: <https://www.gnu.org/software/bash/manual/bash.html#index-compgen>.
|
2018-03-31 17:51:22 +08:00
|
|
|
|
|
|
|
- List all commands that you could run:
|
|
|
|
|
|
|
|
`compgen -c`
|
|
|
|
|
2024-12-26 20:15:40 +02:00
|
|
|
- List all commands that you could run that start with a specified string:
|
|
|
|
|
|
|
|
`compgen -c {{str}}`
|
|
|
|
|
2018-03-31 17:51:22 +08:00
|
|
|
- List all aliases:
|
|
|
|
|
|
|
|
`compgen -a`
|
|
|
|
|
|
|
|
- List all functions that you could run:
|
|
|
|
|
|
|
|
`compgen -A function`
|
|
|
|
|
2021-08-15 19:59:09 +02:00
|
|
|
- Show shell reserved keywords:
|
2018-03-31 17:51:22 +08:00
|
|
|
|
|
|
|
`compgen -k`
|
|
|
|
|
|
|
|
- See all available commands/aliases starting with 'ls':
|
|
|
|
|
|
|
|
`compgen -ac {{ls}}`
|
2025-03-23 11:21:47 +02:00
|
|
|
|
|
|
|
- List all users on the system:
|
|
|
|
|
|
|
|
`compgen -u`
|
|
|
|
|
|
|
|
- Display help:
|
|
|
|
|
|
|
|
`compgen --help`
|