Courseiva
easyMultiple ChoiceObjective-mapped

XK0-006 Practice Question: Which command will create a compressed tar…

Which command will create a compressed tar archive of a directory?

⚠ Common exam trap

CompTIA often tests the distinction between create (`-c`), extract (`-x`), and list (`-t`) flags, and the requirement of `-z` for gzip compression, causing candidates to confuse `-czf` with `-xzf` or omit `-z` entirely.

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

The `-czf` flags combine `-c` (create archive), `-z` (compress with gzip), and `-f` (specify archive file name). This creates a compressed tar archive of the specified directory, outputting a `.tar.gz` file. The command `tar -czf archive.tar.gz dir` is the standard syntax for this operation.

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

    Why this is correct

    This creates a gzip compressed tar archive.

  • tar -xzf archive.tar.gz

    Why it's wrong here

    This extracts a tar.gz archive.

  • tar -cf archive.tar dir

    Why it's wrong here

    This creates an uncompressed tar archive.

  • tar -tf archive.tar

    Why it's wrong here

    This lists the contents of a tar archive without creating.

About these practice questions

This XK0-006 question is part of Courseiva's 979-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 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.