At a Linux prompt, checking what a command name resolves to can show how the shell interprets it. Bash’s type builtin reports that interpretation and can show matching executables found through PATH.
I’ll show how to read type output and choose an option to list matches or find a PATH executable.
TL;DR
Bash’s type builtin tells you how the current shell interprets a command name and can show matching executable files.
- Run type NAME for the shell description.
- Use type -t NAME for one category such as builtin or file.
- Use type -a NAME to display all matches Bash reports.
- Use type -P NAME to search PATH for an executable file.
What does the type command do in Linux?
The Bash builtin type reports how the active shell resolves a name, including shell definitions and executables found through PATH.
| Type reported by Bash | Meaning | Example name |
|---|---|---|
| alias | Shell text substitution for a command name | Often customized, for example ls |
| function | Command body defined in the shell | A function declared in a startup file |
| builtin | Command implemented by Bash | printf |
| keyword | Reserved shell syntax | if |
| file | Executable found on PATH | printf also has a disk executable |
For more background on shell shortcuts, see our guide to aliases in Linux.
How to inspect a command with type step by step
Run these checks in the shell where you normally enter the command. I ran the following Bash demonstration: it shows that printf is both a builtin and an executable file, while if is a keyword.
Step 1: Ask Bash how it resolves one name
Pass the command name as an argument to type. Bash prints a sentence describing the first applicable interpretation, which is useful when checking an unfamiliar command before relying on its behavior.
type printf
In this Bash session, the output is:
printf is a shell builtin
This identifies the shell implementation. It does not claim there is no disk program with the same name, so use the all-match option when that distinction matters.
Step 2: Ask for every match
Add -a to see additional matches for the same name.
type -a printf
The demonstration returned:
printf is a shell builtin
printf is /usr/bin/printf
printf is /bin/printf
The first line is the shell builtin. Later lines are executable paths visible to this environment. Your paths and results can differ with your shell configuration and PATH.
Step 3: Print only the command category
type -t printf
For the name checked above, Bash prints:
builtin
This compact label is useful in a conditional that needs to distinguish a builtin from a file.
Step 4: Find a PATH executable
type -P printf
The PATH search in the demonstration printed:
/usr/bin/printf
The output shows one PATH match for printf.
Step 5: Check a shell keyword
In Bash, if is a keyword that starts a conditional construct.
type if
The demonstration printed:
if is a shell keyword
The lookup output above identifies it as a shell keyword.

The screenshot groups the builtin, category label and executable paths from one Bash session.
Pass more than one name to compare commands in the same shell. Choose the option that answers your question, then check each result in that shell.
What should you check when type output surprises you?
| What you see | What to check | Next step |
|---|---|---|
| alias or function | A shell definition shadows a file lookup | Run type -a NAME to list matches |
| file | PATH contains an executable with that name | Run type -P NAME to isolate its path |
| No useful match | The name may be misspelled or unavailable in this shell | Check spelling and PATH, then consult the shell help |
| Different label in another shell | Shells can use different wording and options | Check that shell’s documentation |
A command not found in the current shell may still exist outside its PATH, or it may be available under another name. For command names missing from the lookup, check spelling and whether the expected directory appears in PATH.
For a shell definition, inspect its definition in the current session before changing PATH.
To identify the running shell, inspect the process separately.
The labels in this table describe Bash output. Other shells may use different labels, so check the documentation for the shell at your prompt.
How command types affect a lookup
| Case | What the shell sees | Useful check |
|---|---|---|
| Alias | A name expands to replacement text when aliases are enabled for that context | Inspect the alias definition and compare type -a NAME |
| Function | A shell-defined body runs under the function name | Inspect the function definition in the current shell |
| Builtin | The shell handles the command internally | Ask Bash for its builtin help |
| Keyword | The parser treats the word as syntax | Check it in the shell where the command is entered |
| Executable | A file is found through a directory in PATH | Compare all matches and PATH order |
PATH is a colon-separated list of directories searched for executable names. When several directories contain a matching file, their order affects which executable a PATH search finds.
printf '%s\n' "$PATH"
type -a printf
Read the directory list from left to right, then compare it with the file paths reported by the lookup. Do not edit PATH just because a second match exists. First decide which program the task requires and whether a shell definition is intentional.
For a missing name, confirm spelling and check whether the expected directory appears in PATH. A command may be installed outside those directories, be exposed only in another environment, or be absent. The lookup itself does not install software or search the whole filesystem.
help type
The GNU Bash Reference Manual documents this builtin’s options.
Options, aliases and related commands
Choose an option by the information you need: a description, category, all matches, or an executable path.
| Form | Use | When it helps |
|---|---|---|
| type NAME | Describe the first shell resolution | Check what an interactive command name means |
| type -a NAME | Show applicable matches | Compare shell definitions with executable entries |
| type -t NAME | Return a category label | Use a compact result in a shell check |
| type -P NAME | Search for a PATH executable | Find a path for a command that needs a file |
| alias NAME | Print an alias definition | Inspect text substituted for an aliased name |
Use Bash’s help type for local option details. For a file’s format, use file, which examines file contents.
What type does not tell you
A command lookup identifies resolution, not whether the program is safe to run.
| Question | Check | Why |
|---|---|---|
| Which shell handles this prompt? | Inspect the running shell process | Different shells can implement different lookup behavior |
| What does a Bash flag mean? | Run help type in Bash | The local builtin help describes that shell’s option |
| What is inside a file? | Run file PATH | File identification is separate from command lookup |
| Which executable path is available? | Run type -P NAME | This narrows the check to PATH |
| Why does an alias expand? | Run alias NAME | The definition shows the replacement text |
Start with type in the shell showing unexpected behavior, then inspect an alias or PATH if the result points there. Use the program’s own version or help option for those details.
There are a few distinctions that help when reading command tutorials. A shell builtin is available through that shell, whereas an executable path names a file the shell can find. The same word can refer to both, so a bare name alone does not tell you which implementation a script intends.
Aliases are useful for interactive shortcuts, but scripts should not assume an alias exists in every shell context. A function can also wrap another command and change the behavior associated with its name. If a command behaves unexpectedly, inspect the matching definition before editing a system-wide file.
Use the program’s version or help option after identifying its executable when you need those details.
Linux tutorials sometimes use the words command, program and executable loosely. Here, command name means the word entered at a shell prompt, and executable means a file the shell can locate. Keeping those terms separate makes it clearer whether you are asking about shell syntax, a definition, or a file on disk.
The examples use Bash syntax, including its builtin and options.
A practical check is to run the same lookup at the prompt where the problem appears, then compare it with the command used by the script. Differences can come from the selected shell, startup configuration or the script’s environment. Narrowing those variables is safer than replacing a package based on a name alone.
Aliases and functions also have different maintenance costs. An alias is a substitution intended for shell command entry, while a function holds shell commands under a name. Use a function when the behavior needs several shell commands, and keep the definition in the configuration that should load it.
Conclusion: Use type to inspect shell lookup
Start with the default description when you are unsure which lookup to use.
For Bash-specific behavior, consult the GNU Bash Reference Manual. To keep exploring Linux commands, use the site’s Linux commands cheat sheet.
FAQ
These answers distinguish the Bash builtin from other Linux commands that also deal with types.
What is the type command in Linux?
In Bash, type is a shell builtin that reports how the current shell interprets a command name, including aliases, functions, builtins, keywords and executable files.
What does the type command do in Linux?
It describes the command resolution visible to the current shell. Use type -a for multiple matches, type -t for a category, and type -P for a PATH executable lookup.
Does type identify a file’s format?
No. The type builtin checks shell command names. Use the file command to identify a file’s contents or format.
