LX0-103 · Question #162
What single command (no options or arguments) can be used to fully extract a file called abc.tar.bz2? )
The correct answer is C. tar. The tar command is the only standard utility capable of handling the combined tar-plus-bzip2 format of a .tar.bz2 archive.
Question
What single command (no options or arguments) can be used to fully extract a file called abc.tar.bz2? )
Options
- Agzip
- Bgunzip
- Ctar
- Dbz2unzip
How the community answered
(30 responses)- A7% (2)
- C90% (27)
- D3% (1)
Why each option
The tar command is the only standard utility capable of handling the combined tar-plus-bzip2 format of a .tar.bz2 archive.
gzip only handles the .gz (LZ77) compression format and cannot decompress bzip2-compressed data.
gunzip decompresses .gz files only and has no support for the bzip2 algorithm used in .bz2 files.
tar is a general-purpose archiving tool that supports multiple compression back-ends including bzip2. Modern tar implementations auto-detect the compression type from the file header, so tar with extraction flags handles both decompression and un-archiving of .tar.bz2 files in a single invocation. None of the other listed commands can process both the tar container and bzip2 compression together.
bz2unzip is not a standard Linux command and does not exist in common distributions.
Concept tested: Extracting bzip2-compressed tar archives with tar
Source: https://www.gnu.org/software/tar/manual/tar.html
Topics
Community Discussion
No community discussion yet for this question.