Name

type — stdin  stdout  - file  -- opt  --help  --version

Synopsis

type [options] commands

The type command, like which, locates an executable file in your shell’s search path:

type cat who
cat is /bin/cat
who is /usr/bin/who

However, type is built into the bash shell, whereas which is a program on disk. The type command reveals this:

type which type
which is /usr/bin/which
type is a shell builtin

as well as the locations of other commands:

type rm if
rm is aliased to `/bin/rm -i'
if is a shell keyword

As a built-in command, type is faster than which; however, it’s available only if your shell is bash.

Get Macintosh Terminal Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.