Difficulty: Easy
Correct Answer: cd p*
Explanation:
Introduction / Context:
Wildcards (globbing) let you match filenames and directory names without typing them fully. Knowing which pattern matches “names starting with p” is a basic shell skill useful for navigation and scripting.
Given Data / Assumptions:
p (or you will choose one uniquely).
Concept / Approach:
Shell globbing uses special metacharacters. The asterisk matches zero or more arbitrary characters. The question asks for a directory beginning with p, so the pattern is p. The question mark ? matches exactly one character; bracket expressions like [p] match a single literal from the set, not an entire name.
Step-by-Step Solution:
p and have anything (or nothing) after.Select the wildcard: matches zero or more trailing characters.Combine with cd: run cd p.Ensure the pattern expands to exactly one directory to avoid “too many arguments.”
Verification / Alternative check:
Use echo p* to preview matches before running cd. If multiple directories match (projects, papers), specify more letters (e.g., cd proj*).
Why Other Options Are Wrong:
p only.pa, not general “starts with p”.cd p* is valid.
Common Pitfalls:
Forgetting that globbing is performed by the shell before invoking cd; having multiple matches causes ambiguity; hidden directories (starting with dot) are not matched by p* unless explicitly included.
Final Answer:
cd p*
Discussion & Comments