Skip to content
shellmap

typeShow how a name is interpreted — builtin, function, alias, or file across all 5 shells

Equivalents in every shell

Bashunix
type ls

Builtin. Reports "alias", "builtin", "function", "file", or "keyword". Use `type -a ls` to list every interpretation in priority order.

Zshunix
type ls

Builtin; equivalent to `whence -v`. Same `-a` flag for listing every match.

Fishunix
type ls

Fish builtin. Reports "alias" / "function" / "builtin" / file path. `type -q ls` exits 0 if the name resolves (quiet existence check).

PowerShellwindows
Get-Command ls

Returns 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 cd
Zsh
type cd
Fish
type cd
PowerShell
Get-Command cd

List every interpretation in priority order

Bash
type -a python
Zsh
type -a python
PowerShell
Get-Command python -All

Silently check whether a command exists (script-friendly)

Bash
type ffmpeg >/dev/null 2>&1 && echo present
Fish
type -q ffmpeg; and echo present
PowerShell
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.

Related commands