Challenge - 5 Problems
Tar Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of this tar command?
You run the command
tar -cf archive.tar file1.txt file2.txt in a directory containing file1.txt and file2.txt. What does the command do?Linux CLI
tar -cf archive.tar file1.txt file2.txt
Attempts:
2 left
💡 Hint
The -c option means create, and -f specifies the archive file name.
✗ Incorrect
The command creates an uncompressed archive named archive.tar containing the specified files. It does not compress or extract files.
💻 Command Output
intermediate1:30remaining
What does this command output?
You run
tar -tf archive.tar. What is the output?Linux CLI
tar -tf archive.tar
Attempts:
2 left
💡 Hint
The -t option lists contents without extracting.
✗ Incorrect
The -t option lists the files inside the archive without extracting them.
🔧 Debug
advanced2:00remaining
Why does this tar extraction command fail?
You run
tar -xf archive.tar.gz but get an error saying 'Cannot open: Not in gzip format'. What is the problem?Linux CLI
tar -xf archive.tar.gz
Attempts:
2 left
💡 Hint
Check if the archive is compressed and if the correct option is used.
✗ Incorrect
The -z option tells tar to decompress gzip archives. Without it, tar treats the file as uncompressed and fails if it is compressed.
🚀 Application
advanced2:00remaining
How to create a compressed archive with tar?
You want to create a gzip compressed archive named
backup.tar.gz containing the directory project. Which command achieves this?Attempts:
2 left
💡 Hint
Use the option that compresses with gzip while creating.
✗ Incorrect
The -z option compresses with gzip. The -c option creates the archive, and -f specifies the filename.
🧠 Conceptual
expert2:30remaining
What is the effect of this tar command?
What does the command
tar --exclude='*.log' -czf archive.tar.gz /var/logs do?Attempts:
2 left
💡 Hint
The --exclude option skips files matching the pattern during archive creation.
✗ Incorrect
The command creates a gzip compressed archive of /var/logs but skips all files ending with .log.