Bird
0
0

You have a zip archive backup.zip containing folders and files. You want to extract only files with .txt extension to /tmp/extract. Which command is correct?

hard📝 Application Q9 of 15
Linux CLI - Archiving and Compression
You have a zip archive backup.zip containing folders and files. You want to extract only files with .txt extension to /tmp/extract. Which command is correct?
Aunzip backup.zip -d /tmp/extract '*.txt'
Bunzip -d /tmp/extract backup.zip '*.txt'
Cunzip -x '*.txt' backup.zip -d /tmp/extract
Dunzip backup.zip '*.txt' -d /tmp/extract
Step-by-Step Solution
Solution:
  1. Step 1: Understand unzip syntax for extracting specific files

    The pattern for files to extract comes immediately after the archive name, followed by the -d option for destination.
  2. Step 2: Analyze options

    unzip backup.zip '*.txt' -d /tmp/extract correctly places the pattern after archive and then the destination. Others misplace options or use invalid flags.
  3. Final Answer:

    unzip backup.zip '*.txt' -d /tmp/extract -> Option D
  4. Quick Check:

    unzip archive pattern -d destination [OK]
Quick Trick: Put file pattern after archive, then -d destination [OK]
Common Mistakes:
  • Placing -d before archive
  • Using -x to include files
  • Misordering arguments

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes