Courseiva
GNU and Unix Commands →hardMultiple Choice

LPIC-1 GNU and Unix Commands Practice Question

A Linux administrator needs to find all files in the /var/log directory that are larger than 10 MB and have not been accessed in the last 30 days. The administrator also wants to delete these files to free up space. Which command will accomplish this safely, prompting for confirmation before each deletion?

⚠ Common exam trap

The trap here is mixing up -atime, -mtime, and -ctime; only -atime tracks the last access time as required.

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 -size +10M -atime +30 -exec rm -i {} \;

The find command with -atime +30 correctly identifies files not accessed in the last 30 days. Combining -size +10M filters for files larger than 10 MB. The -exec rm -i {} \; ensures interactive deletion, prompting for each file. This satisfies the size, access time, and safety requirements. The other options either use the wrong time attribute or delete without confirmation.

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 -size +10M -mtime +30 -exec rm -i {} \;

    Why it's wrong here

    The -mtime +30 matches files modified more than 30 days ago, not accessed. The requirement specifies files not accessed in the last 30 days, so this uses the wrong time attribute. It could delete files that were recently read but not modified, which may not be desired.

  • ✓

    find /var/log -type f -size +10M -atime +30 -exec rm -i {} \;

    Why this is correct

    This find command selects regular files (-type f) larger than 10 MB (-size +10M) that were last accessed more than 30 days ago (-atime +30). The -exec rm -i {} \; runs rm interactively for each file, prompting the user before deletion. This meets all criteria safely.

  • ✗

    find /var/log -type f -size +10M -atime +30 -delete

    Why it's wrong here

    The -delete action removes files without prompting, which violates the requirement for confirmation before each deletion. While it correctly identifies files by size and access time, it deletes them silently. This is unsafe for the scenario because accidental deletion of important logs could occur.

  • ✗

    find /var/log -type f -size +10M -ctime +30 -exec rm -i {} \;

    Why it's wrong here

    The -ctime +30 matches files whose status was last changed more than 30 days ago, which includes metadata changes like permissions or ownership. This is not the same as access time. The requirement is based on access time, so this could select the wrong files and delete them after confirmation.

About these practice questions

Courseiva writes every LPIC-1 question from scratch — 402 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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official LPI exam blueprint

This LPIC-1 practice question is part of Courseiva's free LPI 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 LPIC-1 exam.