Bird
0
0

You want to create a backup script that excludes temporary files (*.tmp) from /home/user before archiving. Which tar command is correct?

hard📝 Application Q9 of 15
Linux CLI - System Administration
You want to create a backup script that excludes temporary files (*.tmp) from /home/user before archiving. Which tar command is correct?
Atar --exclude='*.tmp' -czf backup.tar.gz /home/user
Btar -czf backup.tar.gz /home/user --exclude '*.tmp'
Ctar -czf backup.tar.gz /home/user --exclude='*.tmp'
Dtar -czf backup.tar.gz /home/user
Step-by-Step Solution
Solution:
  1. Step 1: Understand tar exclude syntax

    --exclude='pattern' must appear before the source directory to exclude matching files.
  2. Step 2: Check option placement

    tar --exclude='*.tmp' -czf backup.tar.gz /home/user places --exclude before source, correctly excluding *.tmp files.
  3. Final Answer:

    tar --exclude='*.tmp' -czf backup.tar.gz /home/user -> Option A
  4. Quick Check:

    Exclude option before source directory = correct [OK]
Quick Trick: Place --exclude before source directory in tar command [OK]
Common Mistakes:
  • Putting --exclude after source directory
  • Omitting exclude option
  • Wrong quoting of pattern

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes