Courseiva
Essential CommandseasyMultiple ChoiceObjective-mapped

LFCS Essential Commands Practice Question

To compress a file while preserving the original file, which command should be used?

⚠ Common exam trap

Linux Foundation often tests the default behavior of `gzip` (which deletes the original) versus the `-k` flag, trapping candidates who assume compression always preserves the source file without an explicit option.

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

gzip -k file.txt

The `-k` (or `--keep`) flag in `gzip` instructs the utility to compress the file while retaining the original uncompressed file. By default, `gzip` replaces the original file with a compressed version (appending `.gz`), so `-k` is the explicit option to preserve the source 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.

  • gzip file.txt

    Why it's wrong here

    This compresses but removes the original.

  • gzip -d file.txt.gz

    Why it's wrong here

    This decompresses the file, not compresses.

  • gzip -1 file.txt

    Why it's wrong here

    This compresses with level 1, but still removes the original unless -k is also used.

  • gzip -k file.txt

    Why this is correct

    The -k option keeps the original file after compression.

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 →

How Courseiva writes practice questions · Editorial policy

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.