Bird
0
0

You want to create a compressed archive of the project/ folder, but exclude all .log files inside it. Which command achieves this?

hard📝 Application Q15 of 15
Linux CLI - Archiving and Compression
You want to create a compressed archive of the project/ folder, but exclude all .log files inside it. Which command achieves this?
Atar -czvf project.tar.gz --exclude='*.log' project/
Btar -czvf project.tar.gz project/ --exclude='*.log'
Ctar -cvzf project.tar.gz project/ --exclude='*.log'
Dtar -xvzf project.tar.gz --exclude='*.log' project/
Step-by-Step Solution
Solution:
  1. Step 1: Understand exclusion and compression flags

    The --exclude='*.log' option excludes files matching the pattern. -c creates, -z compresses with gzip, -v shows progress, and -f specifies the archive filename.
  2. Step 2: Check correct flag order and placement

    The exclude option must come before the folder argument. tar -czvf project.tar.gz --exclude='*.log' project/ correctly places --exclude='*.log' before project/ and uses correct flags.
  3. Final Answer:

    tar -czvf project.tar.gz --exclude='*.log' project/ -> Option A
  4. Quick Check:

    Exclude before folder, use -czvf for compressed archive [OK]
Quick Trick: Put --exclude before folder, use -czvf to create compressed archive [OK]
Common Mistakes:
  • Placing --exclude after folder argument
  • Using -x (extract) instead of -c (create)
  • Mixing flag order or misspelling exclude

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes