tar Interview Questions and Answers¶
Introduction¶
These questions test whether you understand what tar does, when to use it, and how to verify the result on Linux.
Beginner Questions¶
What does tar do?
It creates, lists, and extracts archive files.
Show a basic command.
tar -cf logs.tar /var/log
Intermediate Questions¶
Name useful options.
-c: create an archive.-x: extract an archive.-t: list archive contents.
Show a common administrator command.
tar -tf logs.tar
Scenario-Based Questions¶
How would you handle tar create and extract?
tar -czf backup.tar.gz /etc
What would you verify afterward?
tar -tf app-backup.tar.gz | head
Expected output should look similar to:
srv/app/
srv/app/app.conf
srv/app/bin/start.sh
Practical Task Questions¶
Practice in a lab by running a safe version of the command, explaining the target, and showing the verification output.
Quick Review¶
tar -cf logs.tar /var/log
tar -tf logs.tar
tar -tf app-backup.tar.gz | head
Related Guides¶
Summary¶
A strong tar answer includes the purpose, a correct example, a common mistake, and a verification command with output you can interpret.