type — Show how a name is interpreted — builtin, function, alias, or file across all 5 shells
Equivalents in every shell
Bashunix
type lsBuiltin. Reports "alias", "builtin", "function", "file", or "keyword". Use `type -a ls` to list every interpretation in priority order.
Fishunix
type lsFish builtin. Reports "alias" / "function" / "builtin" / file path. `type -q ls` exits 0 if the name resolves (quiet existence check).
PowerShellwindows
Get-Command lsReturns a `CommandInfo` with `CommandType` of Alias/Function/Cmdlet/Application/Script. There is no bare `type` cmdlet — `type` is an alias for `Get-Content`.
cmd.exewindows
type file.txt`type` in cmd PRINTS A FILE — same name, totally different semantics. Use `where /Q name` to test for existence; there is no built-in command-introspection lookup.
Worked examples
Identify how `cd` is currently bound
Bash
type cdZsh
type cdFish
type cdPowerShell
Get-Command cdList every interpretation in priority order
Bash
type -a pythonZsh
type -a pythonPowerShell
Get-Command python -AllSilently check whether a command exists (script-friendly)
Bash
type ffmpeg >/dev/null 2>&1 && echo presentFish
type -q ffmpeg; and echo presentPowerShell
if (Get-Command ffmpeg -ErrorAction SilentlyContinue) { "present" }Gotchas
- Bash `type` and cmd `type` share a name but do COMPLETELY different things — bash reports command type, cmd prints file contents. Running `type README.md` in bash says 'README.md: not found'; in cmd it dumps the file.
- PowerShell `type` is an alias for `Get-Content`, not the bash `type`. To inspect a command, use `Get-Command` (or `gcm`).
- Bash `type -t name` returns a single word (`alias|keyword|function|builtin|file`) — useful in scripts. Zsh has the same flag; fish does not (use `type -q` for existence or parse the full output).
- Fish `type` lists aliases as the actual function body that defines them — fish stores aliases as functions, not name-string pairs. The output can be surprising for users coming from bash.
- `type` cannot see through PATH the way `which` can — if a name has multiple PATH matches but resolves to a builtin first, only the builtin is reported unless you pass `-a`.
WSL & PowerShell Core notes
pwshOn every platform PowerShell aliases `type` to `Get-Content`, so the Unix-style command-introspection meaning is unavailable. Always use `Get-Command` (or remove the alias with `Remove-Item Alias:type` if you really need the symbol free).
WSLInside WSL, `type` is the bash builtin and behaves identically to native Linux. The cmd built-in `type` (print file) is reachable only as `cmd.exe /c type ...`, and is rarely useful from WSL.