XK0-006 System Management Practice Question
A Linux administrator needs to locate all files in the /var/log directory that have been modified within the last 2 days and contain the word 'error' (case-insensitive). Which command accomplishes this?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
find /var/log -mtime -2 -exec grep -li 'error' {} \;
The correct command uses -mtime -2 to find files modified less than 2 days ago, and -exec grep -li 'error' to perform a case-insensitive search for 'error' in file contents, listing filenames. Option A uses -mtime +2 (files older than 2 days). Option B uses -name to match filenames, not content. Option C uses grep -l without -i, so it would miss case variations.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
find /var/log -mtime +2 -exec grep -li 'error' {} \;
Why it's wrong here
-mtime +2 finds files older than 2 days, not within the last 2 days.
- ✗
find /var/log -name '*error*' -mtime -2
Why it's wrong here
-name matches filenames, not content.
- ✗
find /var/log -mtime -2 -exec grep -l 'error' {} \;
Why it's wrong here
Missing -i for case-insensitive search.
- ✓
find /var/log -mtime -2 -exec grep -li 'error' {} \;
Why this is correct
Correctly finds files modified within 2 days and searches for 'error' case-insensitively.
Go deeper
Related to this question
About these practice questions
Courseiva writes every XK0-006 question from scratch — 979 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.