Question 260
A helpdesk colleague describes this Linux behavior: A backup trainee compresses an archive with xz but expects a .tar.gz extension and later chooses the wrong decompression option. Why does the recommended action work?
Explanation
Correct Answer
The tar compression selector must match the actual compressor, and xz differs from gzip and bzip2. This explains the stated Linux behavior. The corresponding safe action is: Use tar with the xz compression option, such as tar -cJf backup.tar.xz for creation. Confirm it with: A tar -tJf listing succeeds and a test extraction reproduces the files.
Incorrect Answers
The offered principle concerns: gzip compresses an input file; creating a tar container is optional and serves a different packaging purpose. That is not what the current scenario establishes. Its controlling mechanism is: The tar compression selector must match the actual compressor, and xz differs from gzip and bzip2.
The -C option changes the extraction destination, reducing accidental overwrites in the current directory. That principle governs the offered alternative, but the facts in this question are explained by: The tar compression selector must match the actual compressor, and xz differs from gzip and bzip2. The two technical dependencies must be distinguished.
The alternative mechanism is: tar packages files and their metadata into an archive, while gzip alone compresses individual input streams. The present evidence instead rests on: The tar compression selector must match the actual compressor, and xz differs from gzip and bzip2.