Courseiva
GNU and Unix CommandsmediumMultiple ChoiceObjective-mapped

LPIC-1 GNU and Unix Commands Practice Question

After receiving a compressed tarball archive.tar.gz from a colleague, you want to list its contents without extracting. Which command should you use?

⚠ Common exam trap

Many candidates confuse the `-x` (extract) flag with `-t` (list) because both are used for reading archives, but only `-t` lists without extracting; LPI often tests this by offering `-xzf` as a distractor, assuming candidates will misremember the flag for listing.

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

The `tar -tvf archive.tar.gz` command lists the contents of a compressed tarball without extracting it. The `-t` option tells tar to list the archive's table of contents, `-v` provides verbose output (showing file permissions, ownership, etc.), and `-f` specifies the archive file. Tar automatically detects and decompresses the gzip compression when reading the file, so no separate decompression step is needed.

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 -xzf archive.tar.gz

    Why it's wrong here

    This extracts the archive, not list contents.

  • tar -cvf archive.tar.gz

    Why it's wrong here

    This creates an archive, not list contents.

  • gzip -d archive.tar.gz | tar -t

    Why it's wrong here

    While this works, it decompresses and then lists, which is less efficient than using -tvf directly.

  • tar -tvf archive.tar.gz

    Why this is correct

    -t lists the contents of the archive without extracting.

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 →

How Courseiva writes practice questions · Editorial policy

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.