Bird
0
0

What does the grep command do in Linux?

easy📝 Conceptual Q11 of 15
Linux CLI - Text Processing
What does the grep command do in Linux?
ASearches text for lines matching a pattern
BDeletes files matching a pattern
CCopies files to another directory
DLists all files in a directory
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of grep

    The grep command is used to search text for lines that match a given pattern.
  2. Step 2: Compare options

    Options B, C, and D describe other commands like rm, cp, and ls, not grep.
  3. Final Answer:

    Searches text for lines matching a pattern -> Option A
  4. Quick Check:

    grep = search text lines [OK]
Quick Trick: grep finds lines with your pattern in text [OK]
Common Mistakes:
  • Confusing grep with file commands like rm or cp
  • Thinking grep modifies files instead of searching
  • Assuming grep lists files instead of searching content

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes