Courseiva
Question 7 of 144
server-administrationmediumMultiple ChoiceObjective-mapped

SK0-005 server-administration Practice Question

A Linux server administrator notices that the /var partition is 95% full. To free space quickly, the administrator decides to delete old log files. Which of the following commands should the administrator use to find and delete log files older than 30 days in the /var/log directory?

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 -name "*.log" -mtime +30 -exec rm {} \\;

Option A is correct. The `find` command with `-mtime +30` locates files modified more than 30 days ago, and `-exec rm {} \;` safely deletes each file. Option B is syntactically invalid. Option C incorrectly pipes `ls` output through `grep` and then to `rm`, which does not accept piped input. Option D searches file contents for the text '30 days' rather than file age.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • rm /var/log/*.log -30

    Why it's wrong here

    This syntax is incorrect; `rm` does not have a `-30` option and would not filter by age.

  • ls -l /var/log/*.log | grep "30" | rm

    Why it's wrong here

    Piping to `rm` does not work as `rm` ignores standard input; it would likely fail with an error or delete nothing.

  • grep -R "30 days" /var/log | xargs rm

    Why it's wrong here

    This command searches the content of files for the phrase '30 days', not the modification time, and would remove files based on content matches.

  • find /var/log -name "*.log" -mtime +30 -exec rm {} \\;

    Why this is correct

    This command correctly identifies and removes log files older than 30 days without exceeding command-line limits.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jul 26, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This SK0-005 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 SK0-005 exam.