LFCS tar -czvf Practice Question
An administrator needs to compress a directory named 'project' into a tarball with maximum compression using gzip. Which command is appropriate?
⚠ Common exam trap
Candidates often confuse the compression flags (`-z` for gzip, `-j` for bzip2, `-J` for xz) and may pick option A or C thinking they provide 'maximum compression' without realizing the question specifically requires gzip, not just any compression.
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 -czvf archive.tar.gz project
The `-z` flag tells tar to compress the archive using gzip. The `-c` flag creates a new archive, `-v` provides verbose output, and `-f` specifies the archive filename. The `.tar.gz` extension is the conventional extension for a gzip-compressed tarball. Although other tools like bzip2 or xz can achieve higher compression ratios, the question explicitly asks for using gzip.
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 -cjvf archive.tar.bz2 project
Why it's wrong here
Uses bzip2 compression, not gzip.
- ✓
tar -czvf archive.tar.gz project
Why this is correct
Creates a gzip-compressed tarball.
- ✗
tar -cJvf archive.tar.xz project
Why it's wrong here
Uses xz compression, not gzip.
- ✗
tar -cvf archive.tar project
Why it's wrong here
Creates an uncompressed tarball.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LFCS question from scratch — 507 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 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.