CompTIA A+ Core 2 (220-1002) — Question 370
A Linux user wants to use the grep command to identify every file name in the current directory that contains the word `mandatory`. Which of the following commands would BEST accomplish this?
Answer options
- A. grep ג€"d mandatory *
- B. grep ג€"i mandatory *
- C. grep mandatory file
- D. grep mandatory *
Correct answer: B
Explanation
The correct option is B because the '-i' flag makes the search case-insensitive, allowing it to match 'mandatory' regardless of its casing. Option A is incorrect due to the use of an invalid flag, and option C specifies a single file rather than searching all files in the directory. Option D would work but does not provide case insensitivity.