Bird
0
0

Which of the following is the correct syntax to recursively search for the string 'hello' in the directory /home/user?

easy📝 Syntax Q3 of 15
Linux CLI - Searching and Finding
Which of the following is the correct syntax to recursively search for the string 'hello' in the directory /home/user?
Agrep /home/user -r 'hello'
Bgrep 'hello' -r /home/user
Cgrep -r 'hello' /home/user
Dgrep -R /home/user 'hello'
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct grep syntax

    The pattern comes immediately after options, then the path.
  2. Step 2: Check each option

    grep -r 'hello' /home/user uses grep -r 'hello' /home/user which is correct syntax.
  3. Final Answer:

    grep -r 'hello' /home/user -> Option C
  4. Quick Check:

    Correct syntax = B [OK]
Quick Trick: Pattern goes right after options, then path [OK]
Common Mistakes:
  • Placing path before options
  • Mixing order of pattern and path
  • Using uppercase -R which is valid but not in options

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes