Image of Austin Gatlin's face
March 18, 2022

Shell Builtin Function: Type

type tells you about the type of command you are inspecting. Tested on MacOS in Zsh.

type wow
# -> wow not found
function wow() { echo wow }
# -> hey
type wow
# -> wow is a shell function
type cat
# -> cat is /bin/cat
type type
# -> type is a shell builtin

Assuming I have a custom shell function in ~/.zshrc called blah

type blah
# -> blah is a shell function from ~/.zshrc

Assuming I have an alias g for git in ~/.zshrc

type g
# -> g is an alias for git
type git
# -> git is /usr/bin/git

In zsh, the docs are in man zshbuiltins. There you learn that type is an alias for whence -v and takes almost the same flags as whence, which can also be found in man zshbuiltins.