Name

type [options] commands — bash

Synopsis

shell built-in stdin stdout - file -- opt --help --version

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

$ type grep who
grep is /bin/grep
who is /usr/bin/who

However, type is built into the bash shell, whereas which is a program on disk:

$ type which type rm if
which is /usr/bin/which
type is a shell builtin
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 you’re running bash.

Get Linux 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.