type vs which vs command -v — Find What a Command Really Is
Resolve whether a command is an alias, shell builtin, function, or executable — and see every copy on your PATH — with the right tool for each job.
01Command
$ type -a ll && which -a python3 && command -v git02What it does
These three look similar but answer different questions: type knows about the shell itself (aliases, functions and builtins) and reports matches in the order bash would actually use them; which only searches PATH for executable files and knows nothing about aliases — a classic trap when your alias shadows a binary; command -v is the POSIX-standard, scripting-safe version that prints just the path or name and fails silently when not found, making it the correct choice inside scripts. type -a is the one to reach for when 'the command does something unexpected', because it lists every definition the shell would consider.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- bash(1) — Linux manual pageEvidence: Documents the type builtin (resolves aliases, builtins, functions and files in lookup order), and command -v as the POSIX-portable lookup.
- which(1) — Linux manual pageEvidence: which locates executables in PATH; -a lists all matches instead of only the first.
Last verified: 2026-09-18 · Category: Developer