Bird
0
0

A script uses cat /var/log/syslog | grep 'fail' but returns no results. You know there are failures logged. What is the problem?

medium📝 Debug Q7 of 15
Linux CLI - System Administration
A script uses cat /var/log/syslog | grep 'fail' but returns no results. You know there are failures logged. What is the problem?
AThe grep pattern is case-sensitive and logs use 'Fail' or 'FAIL'
Bcat cannot read syslog
Cgrep does not work with piped input
DThe syslog file is corrupted
Step-by-Step Solution
Solution:
  1. Step 1: Analyze grep pattern sensitivity

    grep is case-sensitive by default, so 'fail' won't match 'Fail' or 'FAIL'.
  2. Step 2: Check command pipeline validity

    cat can read syslog if permissions allow, and grep works with piped input. Corruption is less likely if file is readable.
  3. Final Answer:

    The grep pattern is case-sensitive and logs use 'Fail' or 'FAIL' -> Option A
  4. Quick Check:

    grep needs -i for case-insensitive search [OK]
Quick Trick: Add -i to grep for case-insensitive matching [OK]
Common Mistakes:
  • Thinking cat can't read syslog
  • Believing grep fails with pipes
  • Assuming file corruption without evidence

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes