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
| Flag | Meaning |
|---|---|
| -a | Every meaning of the name, in the order the shell would consider them. |
| -t | One word only: alias, keyword, function, builtin or file. |
| -P | Force a PATH lookup even if the name is also an alias or function (bash). |
| -f | Ignore shell functions. |
Examples
type -a lsReveals the alias first and the /bin/ls binary second.
type -t rmPrints "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