Search PATH to see which executable runs when the user types python3.
Alias or shell-function details are not needed.
Which command is appropriate?
which searches PATH directories and prints the executable corresponding to a command name.
Detailed explanation
which python3Correct. which python3 reports the PATH-resolved executable.
Correct. which python3 reports the PATH-resolved executable.
whereis python3Incorrect. whereis searches standard locations for binaries, sources, and manuals.
Incorrect. whereis searches standard locations for binaries, sources, and manuals.
locate python3Incorrect. locate searches its filename database rather than command resolution.
Incorrect. locate searches its filename database rather than command resolution.
find python3Incorrect. find requires a start path and predicates.
Incorrect. find requires a start path and predicates.
Try it yourself
An example you can run in a temporary verification environment.
which shExpected result
/usr/bin/shや/bin/shなど、PATH上のshのパスKey points
- which searches PATH
- whereis covers several kinds
- locate searches a database
Notes
- Environment: Linux / which / 現在のPATHを照会
- 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.