Bird
0
0

You want to monitor cron logs for failures only. Which command combination will show lines containing 'CRON' and 'FAILED' in real time?

hard📝 Workflow Q8 of 15
Linux CLI - Cron and Scheduling
You want to monitor cron logs for failures only. Which command combination will show lines containing 'CRON' and 'FAILED' in real time?
Agrep 'FAILED' /var/log/cron | tail -f
Btail -f /var/log/cron | grep -e 'CRON' -e 'FAILED'
Ctail -f /var/log/cron | grep 'FAILED CRON'
Dtail -f /var/log/cron | grep 'CRON' | grep 'FAILED'
Step-by-Step Solution
Solution:
  1. Step 1: Understand filtering multiple patterns

    To show lines containing both 'CRON' and 'FAILED', pipe grep twice: first for 'CRON', then for 'FAILED'.
  2. Step 2: Analyze options

    grep 'FAILED' /var/log/cron | tail -f is invalid because tail -f cannot follow piped input. tail -f /var/log/cron | grep 'FAILED CRON' searches for combined string 'FAILED CRON' which is unlikely. tail -f /var/log/cron | grep -e 'CRON' -e 'FAILED' shows lines with either 'CRON' or 'FAILED', not both.
  3. Final Answer:

    tail -f /var/log/cron | grep 'CRON' | grep 'FAILED' -> Option D
  4. Quick Check:

    Chain grep to filter multiple patterns [OK]
Quick Trick: Use multiple grep pipes to filter multiple keywords [OK]
Common Mistakes:
  • Using grep -e with OR instead of AND logic
  • Trying to tail -f after grep
  • Searching for combined string instead of separate keywords

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes