LFCS · Question #762
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 used to extract .tar.bz2 archives as it handles both the tar archive format and can decompress bzip2 compressed files directly.
Question
Options
- Agzip
- Bgunzip
- Ctar
- Dbz2unzip
How the community answered
(54 responses)- A2% (1)
- B4% (2)
- C87% (47)
- D7% (4)
Why each option
The `tar` command is used to extract `.tar.bz2` archives as it handles both the tar archive format and can decompress bzip2 compressed files directly.
`gzip` is a compression utility specifically for `.gz` files and cannot extract `.tar.bz2` files.
`gunzip` is a decompression utility specifically for `.gz` files and cannot extract `.tar.bz2` files.
The `tar` command is capable of handling both the archiving (tar) and the decompression (bz2) aspects of a `.tar.bz2` file. Modern `tar` implementations often auto-detect the compression type (like bzip2) and perform decompression automatically when extracting, making it the single command to fully extract such files.
`bz2unzip` is not a standard Unix/Linux command; the standard command is `bunzip2` or `bzip2 -d`, which only decompresses the `.bz2` part, not extracts the `.tar` archive.
Concept tested: Extracting tar.bz2 archives
Source: https://www.gnu.org/software/tar/manual/tar.html
Topics
Community Discussion
No community discussion yet for this question.