LFCS Essential Commands Practice Question
A system administrator needs to find all files in /var/log that have been modified in the last 7 days. Which command accomplishes this?
⚠ Common exam trap
A common mix-up: candidates confuse the meaning of the `+` and `-` prefixes with `-mtime`; candidates often mistakenly think `+7` means 'within the last 7 days' when it actually means 'older than 7 days'.
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 -7
The `-mtime -7` option in the `find` command matches files whose content was modified less than 7 days ago (i.e., within the last 7 days). The minus sign before the number indicates 'less than' or 'within the last N days', which is exactly what the system administrator needs to find files modified in the last 7 days.
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 +7
Why it's wrong here
Lists files modified more than 7 days ago.
- ✗
find /var/log -mtime 7
Why it's wrong here
Lists files modified exactly 7 days ago, not within 7 days.
- ✓
find /var/log -mtime -7
Why this is correct
Correctly lists files modified less than 7 days ago.
- ✗
find /var/log -atime -7
Why it's wrong here
Lists files accessed within 7 days, not modified.
Go deeper
Related to this question
About these practice questions
One of 507 original LFCS practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LFCS practice question is part of Courseiva's free Linux Foundation 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 LFCS exam.