XK0-006 System Management Practice Question
Which command is used to display the contents of a compressed log file without decompressing it?
⚠ Common exam trap
XK0-006 often tests whether candidates know that cat and head do not decompress — the trap is assuming any file-reading command handles gzip transparently.
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
✓
zcat
zcat (equivalent to gzip -dc) reads a gzip-compressed file and writes the decompressed content to standard output without modifying the original file. It is the standard tool for viewing .gz log files in place, and it can be piped to less or grep for further processing.
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
Why it's wrong here
head reads the first lines of a file as raw bytes; on a gzip or bzip2 archive it outputs compressed binary, not log entries. It is tempting because head is the usual tool for peeking at the start of a large plain-text log, and would be correct on the decompressed file.
- ✓
zcat
Why this is correct
`zcat` streams decompressed data from gzip-compressed files straight to standard output, leaving the original archive untouched on disk. This satisfies the stem's constraint of reading a compressed log's contents without decompressing it, since no extracted file is written. It also handles `.gz` logs directly, unlike `cat`, which would emit raw binary.
- ✗
cat
Why it's wrong here
cat reads a file's raw bytes, so a compressed log appears as binary garbage rather than readable content. zcat, or cat with a decompression pipe, streams the decompressed text. cat is tempting because it displays plain files, but it performs no decompression.
- ✗
less
Why it's wrong here
less reads plain text and would display compressed binary bytes as garbage, not the log contents. It is tempting because less is the standard pager for viewing files, and would be correct for an uncompressed log, but it performs no decompression, so zcat, zless or bzcat is needed here.
Go deeper
Related to this question
About these practice questions
One of 781 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 →
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 CompTIA exam blueprint
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.