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.
Go deeper
Related to this question
About these practice questions
This SK0-005 question is part of Courseiva's 185-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 and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed July 2026 · checked against the official CompTIA exam blueprint
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.