Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

LPI 010-160 Exam - Topic 3 Question 70 Discussion

Which of the following commands creates the ZIP archive poems.zip containing all files in the current directory whose names end in .txt?
C) zip poems.zip *.txt
A) zip *.txt > poems.zip
B) zcat *.txt poems.zip
D) zip cfz poems.zip *.txt
E) cat *.txt | zip poems.zip

LPI 010-160 Exam - Topic 3 Question 70 Discussion

Actual exam question for LPI's 010-160 exam
Question #: 70
Topic #: 3
[All 010-160 Questions]

Which of the following commands creates the ZIP archive poems.zip containing all files in the current directory whose names end in .txt?

Show Suggested Answer Hide Answer
Suggested Answer: C

The zip command is used to create compressed archive files that can contain one or more files or directories. The zip command takes the name of the archive file as the first argument, followed by the names of the files or directories to be included in the archive. You can also use wildcards to match multiple files or directories with a common pattern. For example, the command zip poems.zip *.txt will create the ZIP archive poems.zip containing all files in the current directory whose names end in .txt. The other commands are either invalid or do not perform the desired operation. The command zip *.txt > poems.zip will try to create an archive for each file ending in .txt and redirect the output to poems.zip, which is not a valid archive file. The command zcat *.txt poems.zip will try to decompress and concatenate the contents of the files ending in .txt and poems.zip, which is not a valid ZIP file. The command zip cfz poems.zip *.txt will fail because the options c, f, and z are not valid for the zip command. The command cat *.txt | zip poems.zip will try to read the contents of the files ending in .txt from the standard input and create an archive named poems.zip, but this will not preserve the file names or attributes of the original files.Reference:

Linux Essentials - Linux Professional Institute (LPI), section 3.1.1

3.1 Archiving Files on the Command Line - Linux Professional Institute Certification Programs, slide


Contribute your Thoughts:

0/2000 characters

Currently there are no comments in this discussion, be the first to comment!


Save Cancel