Determine whether python resolves as an alias, function, builtin, or PATH executable.
Do not limit the result to one candidate.
Which command is appropriate?
type -a shows all candidates Bash can resolve, including aliases, functions, builtins, and files.
Detailed explanation
which pythonIncorrect. which mainly reports one PATH executable and does not cover all Bash definitions.
Incorrect. which mainly reports one PATH executable and does not cover all Bash definitions.
type -a pythonCorrect. type -a reports every matching Bash resolution and its type.
Correct. type -a reports every matching Bash resolution and its type.
whereis pythonIncorrect. whereis searches common files and does not inspect aliases or functions.
Incorrect. whereis searches common files and does not inspect aliases or functions.
find / -name pythonIncorrect. find searches file names and ignores Bash resolution order.
Incorrect. find searches file names and ignores Bash resolution order.
Try it yourself
An example you can run in a temporary verification environment.
bash --noprofile --norc -c 'alias demo="printf alias"; demo(){ :; }; type -a demo'Expected result
demo is a function。functionがaliasより優先して定義される一時例Key points
- type is a shell builtin
- -a lists all candidates
- Resolution type
Notes
- Environment: GNU Bash 5.2 / 一時シェル
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.