Courseiva
Essential Tools →easyMultiple Select

EX200 Essential Tools Practice Question

Which TWO commands can be used to view the contents of a compressed file named 'data.log.gz' without decompressing it permanently? (Choose exactly two.)

⚠ Common exam trap

Red Hat often tests the distinction between commands that permanently decompress (gunzip, gzip -d) versus those that only view the contents (zcat, zless, zmore), and candidates frequently confuse `bzcat` as a valid alternative for .gz files.

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 data.log.gz

B is correct because `zcat` reads the contents of a gzip-compressed file and outputs them to standard output without permanently decompressing the file. It is functionally equivalent to `gunzip -c` and is the standard tool for viewing compressed text files in place.

Answer analysis

Option-by-option breakdown

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

  • ✗

    gunzip data.log.gz

    Why it's wrong here

    gunzip data.log.gz decompresses the file to disk as data.log and then removes the original data.log.gz, so it does not display any output. Unless you also run a separate command such as cat data.log, you never see the contents. Adding -c (gunzip -c data.log.gz) would send the decompressed data to standard output without replacing the file.

  • ✓

    zcat data.log.gz

    Why this is correct

    zcat data.log.gz reads the gzip-compressed file, decompresses it, and writes the result to standard output, leaving data.log.gz completely unchanged. Its non-destructive, streaming behavior makes it ideal for piping into tools like head or grep, or for redirecting to another file. Note that zcat is functionally equivalent to gunzip -c.

  • ✓

    zless data.log.gz

    Why this is correct

    zless data.log.gz uses transparent decompression to display the logs content through an interactive pager, allowing you to scroll and search with less-style key bindings. The compressed file remains untouched on disk, and the decompressed stream is generated on the fly as you page through it. Unlike zcat, which streams all data to stdout, zless is best for hands-on inspection of a large compressed log.

  • ✗

    gzip -d data.log.gz

    Why it's wrong here

    gzip -d data.log.gz is the explicit decompression mode of gzip, but it behaves exactly like gunzip: it restores data.log and deletes the compressed file. Because it writes the decompressed data to the filesystem rather than to standard output, it is not a way to view contents. To preserve the archive and see the data, you would need gzip -dc data.log.gz or zcat.

  • ✗

    bzcat data.log.gz

    Why it's wrong here

    bzcat is intended for bzip2-compressed archives with the .bz2 suffix, not for gzip files such as data.log.gz. Running bzcat data.log.gz will fail because the file's gzip magic bytes (1f 8b) are not a valid bzip2 stream, resulting in a compression format mismatch error. The correct gzip-aware equivalents are zcat and zless.

About these practice questions

Courseiva writes every EX200 question from scratch — 427 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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This EX200 practice question is part of Courseiva's free Red Hat 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 EX200 exam.