Courseiva
System ManagementeasyMultiple ChoiceObjective-mapped

XK0-006 System Management Practice Question

A user needs to view the first 15 lines of a large log file. Which command is most appropriate?

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

head -n 15 filename

head -n 15 filename displays the first 15 lines of a file.

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 15 filename

    Why this is correct

    Correct: head -n 15 shows the first 15 lines.

  • cat filename | head -n 15

    Why it's wrong here

    The pipeline `cat filename | head -n 15` works correctly but is unnecessarily inefficient: `head` can open the file directly, so the extra `cat` process adds a redundant read and pipe overhead without any benefit. It is tempting because many users habitually pipe `cat` into other commands as a generic pattern for feeding file content into a filter, and in scenarios where the file must be processed by multiple commands in sequence (e.g., `cat file | grep pattern | sort`), the `cat` is justified as the initial input source.

  • less -N 15 filename

    Why it's wrong here

    less does not limit lines by default; -N shows line numbers.

  • tail -n 15 filename

    Why it's wrong here

    tail shows the last lines, not the first.

About these practice questions

One of 979 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.