How do I list the functions defined in my shell?
Assuming bash shell:
typeset -f
will list the functions.
typeset -F
will list just the function names.
declare -F
actually prints declare commands and not only function names:
$ declare -F
declare -f function1
declare -f function2
You can use compgen -A function
to print only function names:
$ compgen -A function
function1
function2
declare -F
Function names and definitions may be listed with the
-f
option to thedeclare
builtin command (see Bash Builtins). The-F
option todeclare
will list the function names only (and optionally the source file and line number).
Bash Reference Manual
declare -F
will give you the names of all functions
type function_name
will give you the source for a particular function