LPIC-1 GNU and Unix Commands Practice Question
Which TWO commands can be used to display the contents of a compressed file without decompressing it to disk? (Choose two.)
⚠ Common exam trap
It's easy for candidates to confuse commands that decompress to stdout (like `zcat` and `bzcat`) with commands that decompress to disk (like `gzip -d` or `uncompress`), or they mistakenly think `tar -xzf` only displays the archive contents when it actually extracts them.
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 file.gz
A is correct because `zcat` reads a gzip-compressed file and writes its decompressed content to standard output without saving the decompressed data to disk. This allows you to view the contents of `file.gz` directly in the terminal or pipe it to other commands.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
zcat file.gz
Why this is correct
Equivalent to gunzip -c; outputs to stdout.
- ✗
gzip -d file.gz
Why it's wrong here
gzip -d decompresses to a file (removes .gz) unless output is redirected.
- ✗
tar -xzf file.tar.gz
Why it's wrong here
tar -x extracts the archive to disk.
- ✓
bzcat file.bz2
Why this is correct
Outputs bzip2-compressed file to stdout.
- ✗
uncompress file.Z
Why it's wrong here
uncompress replaces the compressed file with the uncompressed version.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LPIC-1 question from scratch — 527 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LPIC-1 practice question is part of Courseiva's free LPI 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 LPIC-1 exam.