Determine whether cd resolves as an external file, builtin, alias, or function in the current Bash.
Which command is appropriate?
Bash type reports aliases, keywords, functions, builtins, and external files as the shell resolves them.
Detailed explanation
which cdIncorrect. which mainly searches PATH and may not report a shell builtin correctly.
type cdCorrect. type cd reports how Bash resolves the name.
whereis cdIncorrect. whereis searches standard filesystem locations.
locate cdIncorrect. locate searches a filename database.
Try it yourself
An example you can run in a temporary verification environment.
type cdExpected result
cd is a shell builtin相当の表示Key points
- type reports shell resolution
- cd is a builtin
- which is PATH-oriented
Notes
- Environment: Bash 5.x / シェル状態の照会のみ
- Use read-only lookups or disposable paths when verifying search behavior.
- Distribution-specific defaults should be checked before changing system configuration.
Foundation review
Place the operation
A shell-resolution query is different from searching directories for a file with the same name.
Check the side effect
Run the query in the same shell session whose aliases, functions, and PATH matter.