type
The type command is a shell builtin used to determine how a command name is interpreted.
Basic Usage
Check how a command is resolved
type ls
Show All Matches in PATH
Show all command locations
By default, type shows the first match.
To display all matches:
type -a ls
Check Multiple Commands
Check multiple commands at once
type cd echo grep
Verify if Command Is Builtin Only
Check if command is builtin
type cd
If output contains:
- cd is a shell builtin
Then the command is implemented internally by the shell and is not an external binary.
If instead you see something like:
- ls is /bin/ls
Then it is an external executable found in your $PATH.
If it shows:
- ll is aliased to
ls -l
Then it is an alias.