The correct command to extract the contents of the compressed archive file1.tar.gz is tar -xzf file1.tar.gz. This command uses the following options:
-x means extract files from an archive.
-z means filter the archive through gzip, which is a compression program that reduces the size of files.
-f means use the following archive file name, which is file1.tar.gz in this case.
The other commands are incorrect for the following reasons:
tar -czf file1.tar.gz creates a compressed archive file1.tar.gz from the files specified after the command, not extract it.
ztar file1.tar.gz is not a valid command, as ztar is not a standard program or option for tar.
tar --extract file1.tar.gz is missing the -z option to handle the gzip compression, and also the -f option to specify the file name.
detar file1.tar.gz is not a valid command, as detar is not a standard program or option for tar.
References:
Linux Essentials - Topic 106: The Linux Operating System, section 106.2 Use single shell commands and one line command sequences to perform basic tasks on the command line.
LPI Linux Essentials Study Guide: Exam 010 v1.6, 3rd Edition, Chapter 5: Working with Files and Directories, section Compressing and Archiving Files.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit