Courseiva
System ManagementmediumMultiple ChoiceObjective-mapped

XK0-006 System Management Practice Question

A system administrator wants to view the last 10 lines of a log file and also save those lines to another file for analysis. Which command should the administrator use?

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

tail -n 10 file | tee output.txt

tail -n 10 file | tee output.txt displays the last 10 lines of 'file' and writes them to 'output.txt'. Option A uses head, which shows the first lines, not the last. Option B uses cat, which outputs the entire file, not just the last 10 lines. Option D uses tee without a pipe, which is syntactically incorrect; tee reads from stdin, so it requires a pipe from tail.

Answer analysis

Option-by-option breakdown

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

  • head -n 10 file | tee output.txt

    Why it's wrong here

    head shows first lines, not last.

  • cat file | tee output.txt

    Why it's wrong here

    cat outputs entire file, not just last 10 lines.

  • tail -n 10 file | tee output.txt

    Why this is correct

    Correct: tail shows last 10 lines, tee saves to file and displays.

  • tee output.txt < tail -n 10 file

    Why it's wrong here

    Incorrect syntax; redirection order is wrong.

About these practice questions

This XK0-006 question is part of Courseiva's 979-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 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.