Bird
0
0

You have files: app1.log, app2.log, app10.log, app20.log. Which pattern matches only files with single-digit numbers after 'app'?

hard📝 Application Q8 of 15
Linux CLI - File and Directory Operations
You have files: app1.log, app2.log, app10.log, app20.log. Which pattern matches only files with single-digit numbers after 'app'?
Aapp*.log
Bapp?.log
Capp[0-9]*.log
Dapp[1-9]*.log
Step-by-Step Solution
Solution:
  1. Step 1: Understand ? wildcard

    The ? matches exactly one character.
  2. Step 2: Analyze pattern app?.log

    This matches files starting with 'app', then exactly one character, then '.log'. So it matches app1.log and app2.log only.
  3. Step 3: Check other options

    app*.log matches all, app[0-9]*.log matches files starting with 'app' + digit + anything before '.log' so includes app10.log and app20.log, app[1-9]*.log matches multiple digits.
  4. Final Answer:

    app?.log -> Option B
  5. Quick Check:

    Use ? for exactly one character [OK]
Quick Trick: Use ? to match exactly one character after prefix [OK]
Common Mistakes:
MISTAKES
  • Using * which matches multiple characters
  • Confusing [] with ?
  • Assuming [0-9] matches multiple digits

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes