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
It's easy for candidates to confuse `-mtime` (modification time) with `-ctime` (inode change time) or `-atime` (access time), as candidates often mistakenly think 'changed' refers to content modification rather than metadata changes.
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 -type f -mtime -7
The `find` command with `-mtime -7` searches for files whose modification time (content change) is less than 7 days ago, which matches the requirement of 'modified in the last 7 days'. The `-type f` restricts the search to regular files, and `/var/log` is the target directory.
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 -type f -atime -7
Why it's wrong here
Uses access time, not modification time.
- ✗
find /var/log -type f -ctime -7
Why it's wrong here
Uses change time (inode change), not modification time.
- ✗
find /var/log -type f -mtime +7
Why it's wrong here
Finds files modified more than 7 days ago.
- ✓
find /var/log -type f -mtime -7
Why this is correct
Correct: -mtime -7 means modified less than 7 days ago.
Go deeper
Related to this question
About these practice questions
This LFCS question is part of Courseiva's 507-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 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.