Created
December 21, 2018 17:23
-
-
Save skratchdot/7df9dbb10e372f78336b0e1358f80fd3 to your computer and use it in GitHub Desktop.
list-all-commands.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# found these useful commands here: | |
# https://unix.stackexchange.com/questions/60776/list-all-files-binaries-in-current-path/60808#60808 | |
# | |
# compgen -c # will list all the commands you could run. | |
# compgen -a # will list all the aliases you could run. | |
# compgen -b # will list all the built-ins you could run. | |
# compgen -k # will list all the keywords you could run. | |
# compgen -A function # will list all the functions you could run. | |
# compgen -A function -abck # will list all the above in one go. | |
# list everything: | |
compgen -A function -abck | sort | uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put this file in your
$PATH
(I put it in~/bin/
), then add the following to~/.bash_aliases
:This is needed based on https://unix.stackexchange.com/questions/102838/run-script-in-current-shell-without-before-command/102860#102860
I was seeing different results when running:
list-all-commands | wc
vs. list-all-commands | wc
After adding the alias, they are the same