Which command is used to extract the contents of the compressed archive file1.tar.gz?

Prepare for the LPI Linux Essentials 010-160 Test. Study with flashcards and multiple choice questions, each question offers hints and explanations. Get ready to ace your exam!

The command used to extract the contents of a compressed archive file with a .tar.gz extension is "tar -xzf file1.tar.gz". This command leverages the tar utility, which is specifically designed for working with tape archive files. The flags used in the command serve specific purposes:

  • The "x" option tells tar to extract files from the archive.
  • The "z" option indicates that the archive is compressed with gzip, which is the case for .tar.gz files.

  • The "f" option signifies that the next argument is the name of the archive file.

Thus, by using "tar -xzf file1.tar.gz", you're effectively instructing the system to decompress and extract the files from the specified archive.

In contrast, other commands listed are not suitable for handling .tar.gz files in this context. For instance, the "zip" command is commonly used to create and modify zip files, not to extract contents from .tar.gz files. Meanwhile, "gunzip" can be used to decompress files that are solely gzip compressed (without the tar functionality); using it on a .tar.gz file would remove the gzip compression layer but leave you without the ability to handle the tar archive itself. Lastly, the "

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy