Which of the following commands extracts the contents of the compressed archive file1.tar.gz?
The correct command to extract the contents of the compressed archive file1.tar.gz istar -xzf file1.tar.gz. This command uses the following options:
-xmeans extract files from an archive.
-zmeans filter the archive through gzip, which is a compression program that reduces the size of files.
-fmeans 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.gzcreates a compressed archive file1.tar.gz from the files specified after the command, not extract it.
ztar file1.tar.gzis not a valid command, as ztar is not a standard program or option for tar.
tar --extract file1.tar.gzis missing the-zoption to handle the gzip compression, and also the-foption to specify the file name.
detar file1.tar.gzis not a valid command, as detar is not a standard program or option for tar.
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.
Currently there are no comments in this discussion, be the first to comment!