Recall & Review
beginner
What does the
tar command do in Linux?The
tar command bundles multiple files and directories into a single archive file. It can also extract files from such archives.Click to reveal answer
beginner
How do you create a compressed archive named
backup.tar.gz of a directory called myfolder?Use the command:
tar -czf backup.tar.gz myfolder. <br>Here, -c creates an archive, -z compresses with gzip, and -f specifies the archive file name.Click to reveal answer
beginner
How do you extract files from an archive named
archive.tar.gz?Use the command:
tar -xzf archive.tar.gz. <br>-x extracts files, -z decompresses gzip, and -f specifies the archive file.Click to reveal answer
beginner
What option shows the list of files inside a tar archive without extracting?
Use
tar -tf archive.tar. <br>-t lists the contents, -f specifies the archive file.Click to reveal answer
intermediate
Explain the difference between
tar -cf and tar -czf.tar -cf creates an uncompressed archive file. <br>tar -czf creates a gzip compressed archive, making the file smaller.Click to reveal answer
Which
tar option is used to extract files from an archive?✗ Incorrect
-x extracts files. -c creates archives, -t lists contents, and -z compresses or decompresses gzip.What does the
-f option do in the tar command?✗ Incorrect
-f tells tar the name of the archive file to create or extract.How do you create a tar archive without compression?
✗ Incorrect
tar -cf creates an uncompressed archive. -z adds gzip compression.Which command lists the contents of
files.tar without extracting?✗ Incorrect
-t lists archive contents. -x extracts files.What compression does
tar -czf use by default?✗ Incorrect
-z uses gzip compression by default.Describe how to create a compressed tar archive of a folder and then extract it.
Think about the options for create, extract, compression, and file name.
You got /4 concepts.
Explain how to check what files are inside a tar archive without extracting them.
Listing contents is different from extracting.
You got /3 concepts.