Linux Essentials (010-160) — Question 33
Which of the following commands creates the ZIP archive poems.zip containing all files in the current directory whose names end in .txt?
Answer options
- A. zip *.txt > poems.zip
- B. zcat *.txt poems.zip
- C. zip poems.zip *.txt
- D. zip cfz poems.zip *.txt
- E. cat *.txt | zip poems.zip
Correct answer: C
Explanation
The correct answer is C because it directly creates a ZIP file called poems.zip that contains all .txt files in the current directory. Option A incorrectly uses output redirection, while B and E attempt to use commands that do not correctly create a ZIP archive. Option D adds unnecessary flags that are not needed for this task.