LFCS Essential Commands Practice Question
Which THREE commands can be used to view the contents of a compressed archive file without extracting it? (Select three.)
⚠ Common exam trap
Watch out — candidates often confuse commands that *view* contents (like `zcat` and `less`) with commands that *decompress* or *extract* (like `gunzip` and `bunzip2`), failing to recognize that decompression modifies the file system or requires additional flags to avoid extraction.
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
✓
tar -tvf archive.tar.gz
`tar -tvf archive.tar.gz` lists the contents of a tar archive compressed with gzip without extracting it. The `-t` flag tells tar to list the table of contents, `-v` provides verbose output, and `-f` specifies the archive file. This command reads the archive metadata directly from the compressed 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.
- ✓
tar -tvf archive.tar.gz
Why this is correct
Lists contents of tar archive.
- ✓
zcat archive.gz
Why this is correct
Shows contents of gzip file.
- ✗
gunzip archive.gz
Why it's wrong here
Decompresses the file.
- ✓
less archive.gz
Why this is correct
Can view compressed files if lesspipe is configured.
- ✗
bunzip2 archive.bz2
Why it's wrong here
Decompresses the file.
Go deeper
Related to this question
About these practice questions
One of 507 original LFCS 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 by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LFCS practice question is part of Courseiva's free Linux Foundation 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 LFCS exam.