type builtin
A bash builtin that tells you what a name would run: an alias, a keyword, a function, a builtin or a file on disk.
In more detail
Running type -a bash lists every bash along your PATH in search order, which is how you spot that the old /bin/bash still wins over a newer Homebrew one. Because type knows about aliases and functions, it answers more honestly than which, a separate program that only searches PATH.
Examples
type -a bashtype cdRelated terms
- PATH — An environment variable holding a list of folders the shell searches, in order, to find the program for a command you type.
- builtin — A command implemented inside the shell itself rather than as a separate program on disk, such as cd, read or export.
- shell alias — A short name the shell swaps in for the start of a command line, defined with alias name='command'.
- help builtin — A bash builtin that prints the documentation for other builtins, such as help cd or help read.
Taught in
- What A Shell Is, And What Bash Is — Bash Scripting & Command Line Automation
- Which Shell Am I In, And Getting Bash Five — Bash Scripting & Command Line Automation
- Help, History, Completion And Aliases — Bash Scripting & Command Line Automation
- Conditionals: test, Brackets, Double Brackets, case — Bash Scripting & Command Line Automation