Is there a command to get builtin commands on zsh? For example, it is possible to get all builtin commands with the compgen -b command in the bash shell.

1 Answer 1


See info zsh builtins:

This associative array gives information about the builtin commands currently enabled. The keys are the names of the builtin commands and the values are either 'undefined' for builtin commands that will automatically be loaded from a module if invoked or 'defined' for builtin commands that are already loaded.

But note that new builtins are made available when you load more modules with zmodload.

To print the list (the keys of that associative array) raw and ordered on 1 Column:

print -roC1 -- ${(k)builtins}

Or you can print the key and values on two columns to see which ones are already loaded and which ones would be automatically loaded upon first invocation:

print -raC2 -- ${(kv)builtins} | sort

To list all commands and reserved words along with their type, see also:

whence -wm '*'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .