Courseiva
Essential CommandseasyMultiple ChoiceObjective-mapped

LFCS Essential Commands Practice Question

A user wants to find all files in /var/log that have been modified within the last 2 days. Which command should they use?

⚠ Common exam trap

It's easy for candidates to confuse the meaning of the plus (+) and minus (-) signs with `-mtime`, mistakenly thinking `+2` means 'within the last 2 days' or that `-mtime 2` (without sign) means 'within 2 days', when in fact the signs control the direction of the time comparison.

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

The `find` command with `-mtime -2` searches for files whose content was last modified less than 2 days ago (i.e., within the last 48 hours). The minus sign before the number indicates 'less than' or 'within the last N days', which matches the user's requirement to find files modified within the last 2 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 -2

    Why this is correct

    Correct. The `-mtime -2` option finds files modified less than 2 days ago (within the last 48 hours), matching the requirement exactly.

  • find /var/log -mmin -2880

    Why it's wrong here

    Incorrect. Although `-mmin -2880` technically finds files modified within the last 2880 minutes (2 days), the standard and expected command for day-based queries is `-mtime -2`. Using `-mmin` for day intervals is non-standard and may not be available on all systems, so it is not the best answer.

  • find /var/log -mtime +2

    Why it's wrong here

    Incorrect. `-mtime +2` finds files modified more than 2 days ago (i.e., older than 2 days), not within the last 2 days.

  • find /var/log -mtime 2

    Why it's wrong here

    Incorrect. `-mtime 2` finds files modified exactly 2 days ago, without a range, so it does not include files modified within the last 2 days.

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 →

How Courseiva writes practice questions · Editorial policy

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.