Home·Terminal commands

type

Processes and system

Usage

type [-a] <name>

Asks the shell itself what a name really is, whether alias, function, builtin or file, which is exactly what `which` cannot see because it only looks at PATH.

Common flags

FlagMeaning
-aEvery meaning of the name, in the order the shell would consider them.
-tOne word only: alias, keyword, function, builtin or file.
-PForce a PATH lookup even if the name is also an alias or function (bash).
-fIgnore shell functions.

Examples

type -a ls

Reveals the alias first and the /bin/ls binary second.

type -t rm

Prints "file" if nothing is shadowing it, "alias" if something is.

What is running and what is eating the machine. Identifying it comes before killing it.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does type do?

Asks the shell itself what a name really is, whether alias, function, builtin or file, which is exactly what `which` cannot see because it only looks at PATH.

Q. How do I type it?

type [-a] <name> — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

4 are listed here; the full set is in man type. This command sits under Processes and system.

Related commands

man page: man type