nerdexam
LPI

010-160 · Question #16

Which of the following tar options handle compression? (Choose two correct answers.)

The correct answer is B. -z D. -j. The tar command supports gzip compression via -z and bzip2 compression via -j when creating or extracting archives.

The Power of the Command Line

Question

Which of the following tar options handle compression? (Choose two correct answers.)

Options

  • A-bz
  • B-z
  • C-g
  • D-j
  • E-zZ

How the community answered

(51 responses)
  • A
    2% (1)
  • B
    90% (46)
  • C
    6% (3)
  • E
    2% (1)

Why each option

The tar command supports gzip compression via -z and bzip2 compression via -j when creating or extracting archives.

A-bz

-bz is not a valid tar option; each compression algorithm requires its own distinct flag (-z for gzip, -j for bzip2, -J for xz).

B-zCorrect

-z instructs tar to pipe the archive through gzip for compression or decompression, producing .tar.gz or .tgz files.

C-g

-g (--listed-incremental) specifies a snapshot file for incremental backups and has no effect on compression.

D-jCorrect

-j instructs tar to pipe the archive through bzip2, which provides higher compression ratios than gzip and produces .tar.bz2 files.

E-zZ

-zZ is not a valid tar option; tar does not support combining multiple compression flags, and -Z alone refers to the legacy compress utility rather than a compound compression mode.

Concept tested: tar compression flags for gzip and bzip2

Source: https://www.man7.org/linux/man-pages/man1/tar.1.html

Topics

#tar compression#gzip#bzip2#archive options

Community Discussion

7
Ingrid P.Ingrid P.Nov 28, 2025

B and D are your two answers here. The -z flag tells tar to pipe through gzip, and -j tells tar to pipe through bzip2, so both are legitimate compression options built into tar, while the others (-bz, -g, -zZ) are either invalid flags or serve unrelated purposes like incremental backups.

14
Fatima Z.Fatima Z.Nov 30, 2025

Solid breakdown, and the memory hook that saves me every time is GZip Goes first alphabetically so -z lands on G, Jumps to -j for bzip2 because J comes after G just like bzip2 came after gzip historically.

0
Samuel O.Samuel O.Dec 9, 2025

B and D, no debate. When I sat for this one I almost second-guessed myself on -j because in twenty years of sysadmin-adjacent work I typed out bzip2 by hand so often that the single flag felt too clean, but -z is gzip and -j is bzip2 and that is the whole answer. The distractor -g trips people up because it sounds like it belongs there, but -g is for incremental backups, not compression at all.

0
Fatima Z.Fatima Z.Dec 12, 2025

Okay so I picture a ZIP line (that is your -z for gzip) and a JAY bird squeezing into a tiny box (that is your -j for bzip2), and those two birds are the only ones on that compression branch of the tar tree. Can anyone tell me why they get tripped up on -g specifically, because I want to know if the confusion is about what -g actually does versus what people assume it does?

0
Samuel O.Samuel O.Dec 13, 2025

The -g flag trips people up because it sounds like it should mean "gzip" but it actually handles incremental backups via a snapshot file, so the mental shortcut breaks hard right there.

0
Ola B.Ola B.Dec 24, 2025

I kept second-guessing myself on this one because -g looks like it could stand for gzip and threw me off, but then I spun up a quick Ubuntu VM and just ran tar with each flag to watch what happened, and -g turns out to be for incremental backups, not compression at all. The two you want are -z for gzip and -j for bzip2, full stop.

0
Fatima Z.Fatima Z.Dec 25, 2025

Lock it in forever: ZIP starts with Z so -z owns gzip, and say "bzip2" fast three times and you will hear a J hiding in there, so both flags basically name themselves once you know the trick.

0
Full 010-160 Practice