Which command navigates into a directory whose name begins with the letter ‘p’ ?
Show answer Hide answer
Answer: C. cd p*
Explanation
The asterisk acts as a wildcard matching any character sequence following the initial letter p. Combining cd with a wildcard pattern directs the shell to enter the first matching directory entry. Shell globbing expands pattern expressions before passing arguments to the directory change command. The cd command modifies the shell working directory to a specified target file path location. Wildcard characters allow users to specify patterns rather than typing out entire directory names. Command line shells evaluate wildcard expansions automatically before executing underlying system utilities.
Developers use wildcard navigation shortcuts to speed up terminal workflows when directory names are long. Automation scripts occasionally leverage pattern matching to traverse directories with predictable naming conventions. Understanding shell expansion rules prevents common syntax errors during complex command line operations. Option A is incorrect because it looks for a literal directory named p rather than a pattern. Option B is incorrect because the question mark matches exactly one single character instead of multiple. Option D is incorrect because brackets match a single character set rather than a general wildcard sequence.
- Subject
- Computer Science
- Category
- Software Engineering
- Topic
- —
- Difficulty
- medium
Related questions
Q1. Which command permits viewing file contents page-by-page, 24 lines at a time ?
Show answer Hide answer
Answer: B. pg
The pg command functions as an interactive text pager that presents document contents twenty-four lines at a time. Users can easily read lengthy configuration files or log outputs without having the text scroll past too...
Q2. Within the vi editor, which command shifts the cursor one position to the left ?
Show answer Hide answer
Answer: A. h
In vi command mode, pressing the h key shifts the cursor one position left. It serves as a fundamental navigation keystroke for moving horizontally across text lines. Using h avoids reaching for arrow keys, keeping hands...
Q3. Within the vi editor, which command initiates a forward search for a specified pattern ?
Show answer Hide answer
Answer: D. /
The forward slash character serves as the primary command to initiate pattern searches downward in the vi editor. Typing this symbol followed by a search term causes the editor to locate the next occurrence in the text....
Q4. Which command combines all files starting with the prefix ’emp’ and followed by non-numeric characters ?
Show answer Hide answer
Answer: A. cat emp[!0-9]
The pattern emp[!0-9] matches filenames beginning with emp followed by any single character that is not a digit. The exclamation mark inside brackets acts as a negation operator within shell globbing pattern matching syn...
Q5. Where are system and mail log files typically located in Red Hat Linux ?
Show answer Hide answer
Answer: A. /var/log
The standard directory for storing system and mail log files in Linux is var log. Log daemons write event records, authentication attempts, and mail delivery reports here. Centralizing logs in this directory simplifies s...
Q6. Which command alters the permission mode for files starting with the prefix emp and terminating with 1, 2, or 3 ?
Show answer Hide answer
Answer: A. chmod u+x emp[1-3]
The chmod command modifies file permissions while u+x specifically adds execute rights for the file owner. The bracketed wildcard pattern emp[1-3] precisely targets files starting with emp and ending with digits one thro...