Challenge - 5 Problems
Tar Compression Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this tar command?
You run this command in a directory containing a file named
What will be the output?
file.txt with the text Hello inside:tar -czf archive.tar.gz file.txt && tar -tzf archive.tar.gzWhat will be the output?
Linux CLI
tar -czf archive.tar.gz file.txt && tar -tzf archive.tar.gz
Attempts:
2 left
💡 Hint
The
-t option lists files inside the archive. The -z option means gzip compression.✗ Incorrect
The command creates a gzip compressed archive named
archive.tar.gz containing file.txt. The tar -tzf command lists the files inside the gzip compressed archive, which is just file.txt.💻 Command Output
intermediate2:00remaining
What error does this command produce?
You run this command:
What error message will you see?
tar -cjf archive.tar.bz2 file.txt && tar -tzf archive.tar.bz2What error message will you see?
Linux CLI
tar -cjf archive.tar.bz2 file.txt && tar -tzf archive.tar.bz2
Attempts:
2 left
💡 Hint
The
-j option compresses with bzip2, but the -z option tries to decompress with gzip.✗ Incorrect
The archive is compressed with bzip2 (
-j), but the listing command uses -z which expects gzip compression. This mismatch causes tar to fail with the error 'This does not look like a tar archive'.📝 Syntax
advanced2:00remaining
Which command correctly creates an xz compressed tar archive?
You want to create a tar archive compressed with xz compression named
archive.tar.xz containing the folder data. Which command is correct?Attempts:
2 left
💡 Hint
The
-J option is for xz compression.✗ Incorrect
The
-J option tells tar to use xz compression. Other options are for different compressions: -z gzip, -j bzip2, -Z compress (rare).🚀 Application
advanced2:00remaining
How to extract a bzip2 compressed archive to a specific folder?
You have a bzip2 compressed tar archive named
backup.tar.bz2. You want to extract its contents into the folder /tmp/restore. Which command will do this correctly?Attempts:
2 left
💡 Hint
Use
-j for bzip2 and -C to specify extraction directory.✗ Incorrect
The
-j option decompresses bzip2 archives. The -C option tells tar to change to the specified directory before extracting files.🔧 Debug
expert2:00remaining
Why does this tar extraction fail with 'Cannot open: No such file or directory'?
You run this command:
and get the error:
What is the most likely cause?
tar -xzf archive.tar.bz2and get the error:
tar: archive.tar.bz2: Cannot open: No such file or directoryWhat is the most likely cause?
Linux CLI
tar -xzf archive.tar.bz2
Attempts:
2 left
💡 Hint
Check if the file is present in the folder you are running the command from.
✗ Incorrect
The error means the file
archive.tar.bz2 is not found in the current directory. The -z option mismatch would cause a different error. Running as root or corruption would not cause 'No such file or directory'.