Courseiva
System Management →easyMultiple Choice

XK0-006 System Management Practice Question

A Linux administrator needs to locate all files in /var/log that were modified more than 7 days ago. Which command should be used?

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 find command with -mtime +7 finds files modified more than 7 days ago. locate uses a database and does not support -mtime; grep is for text search; ls does not filter by modification time.

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 this is correct

    The +7 argument to -mtime matches files whose modification time is greater than seven 24-hour periods ago, exactly the age threshold the stem specifies. The minus form would instead select files modified within the last seven days.

  • ✗

    grep -mtime +7 /var/log

    Why it's wrong here

    grep searches file contents for matching text patterns and has no -mtime option, so it cannot filter by modification timestamp. It tempts because grep is the standard tool for locating matching data across many files, which is the correct approach when the criterion is content rather than age.

  • ✗

    ls -mtime +7 /var/log

    Why it's wrong here

    ls has no -mtime predicate; it would treat +7 as a filename and list the directory instead of filtering by age. It tempts because ls does list directory contents and supports time-based sorting flags such as -t, making it the intuitive tool before learning find's expression syntax.

  • ✗

    locate -mtime +7 /var/log

    Why it's wrong here

    locate queries a prebuilt filename database and has no -mtime predicate; it cannot evaluate modification times and may return stale paths. It tempts because locate is genuinely the fastest way to find files by name across the whole filesystem when the index is current.

About these practice questions

Courseiva writes every XK0-006 question from scratch — 781 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 →

How Courseiva writes practice questions · Editorial policy

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.