010-100 · Question #21
What is the correct command to extract the contents of the archive file download.bz2?
The correct answer is C. bunzip2 download.bz2. The bunzip2 command is the correct tool for decompressing .bz2 files on Linux/Unix systems.
Question
What is the correct command to extract the contents of the archive file download.bz2?
Options
- Aunpack download.bz2
- Bunzip2 download.bz2
- Cbunzip2 download.bz2
- Dunzip download.bz2
- Euncompress download.bz2
How the community answered
(44 responses)- A2% (1)
- B5% (2)
- C75% (33)
- D7% (3)
- E11% (5)
Why each option
The bunzip2 command is the correct tool for decompressing .bz2 files on Linux/Unix systems.
unpack is not a standard Linux command for decompressing bzip2 archives.
unzip2 does not exist as a standard Linux utility; the correct counterpart to bzip2 is bunzip2.
bunzip2 is the standard decompression utility for bzip2-compressed files (.bz2). It reads the compressed archive and extracts the original file contents in place, removing the .bz2 extension from the output file.
unzip is used for .zip format archives, not .bz2 bzip2-compressed files.
uncompress is used to decompress .Z files created by the compress command, not .bz2 files.
Concept tested: bzip2 decompression command on Linux
Source: https://linux.die.net/man/1/bunzip2
Topics
Community Discussion
8The answer is C, bunzip2 download.bz2. My senior showed me early on that the bz2 format has its own dedicated tool called bunzip2, which is the counterpart to bzip2 the same way gunzip is the counterpart to gzip. Option D trips up a lot of people because unzip is a real command, but it handles ZIP files not bz2 files, so it would just throw an error here. Options A and B are not real Linux commands at all, and uncompress in option E is for the older .Z compress format, not bz2. Once you start thinking about compression tools in matched pairs like that it gets a lot easier to keep them straight.
The matched-pairs framing is solid, and one more layer worth adding is that bunzip2 and bzip2 -d are interchangeable, so if you see a question stem that swaps in the flag form, the logic holds the same way.
The stem says "extract the contents," which nudges people toward D because unzip feels like the natural extraction verb, but unzip only handles ZIP archives, not bz2. bunzip2 is the right tool for bz2 files, so C is your answer.
C is the one to know here, bunzip2 is the native tool for .bz2 files the same way gunzip handles .gz and unxz handles .xz. Do you also know what flag you would pass to tar if you wanted to extract a .tar.bz2 in a single command without running bunzip2 separately first?
bunzip2 is the one, D and E are for zip and compress formats.
Thiago nailed it, though worth adding that bunzip2 is for bzip2-compressed files specifically, so if someone hands you a plain .gz you still need gunzip or gzip -d, which trips people up on the format-recognition questions.
Going with E on this one, uncompress is the utility that handles decompression on Linux systems and it covers the bz2 format as part of that general-purpose role. I actually spun up a quick sandbox last week drilling these exact compression commands and uncompress handled the job without me needing to remember which specific tool matched which extension. The other options are either made-up commands or tools tied to different formats, like unzip is for zip files and that D option would not even run on a bz2 archive. Trust the general-purpose decompression tool here, that is what it exists for.
Ola, I think you might be mixing that one up, uncompress is actually paired with the compress utility and only handles .Z files, not .bz2. The right tool for bz2 archives is bunzip2, which is option C.