Bird
0
0

You execute tar -cjf archive.tar.bz2 folder but receive an error: tar: -c: Cannot open: No such file or directory. What is the most probable cause?

medium📝 Debug Q6 of 15
Linux CLI - Archiving and Compression
You execute tar -cjf archive.tar.bz2 folder but receive an error: tar: -c: Cannot open: No such file or directory. What is the most probable cause?
AThe <code>-f</code> option is missing or misplaced
BThe folder <code>folder</code> does not exist
CThe <code>-j</code> option is not supported on your system
DYou need to run the command as root
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the command syntax

    The command uses -cjf which combines create, bzip2 compression, and file options.
  2. Step 2: Identify the error cause

    The error indicates tar is interpreting -c as a filename, meaning -f is missing or misplaced.
  3. Step 3: Correct usage

    The correct syntax is tar -cjf archive.tar.bz2 folder where -f must be immediately followed by the archive filename.
  4. Final Answer:

    The -f option is missing or misplaced -> Option A
  5. Quick Check:

    Always place -f before the archive filename [OK]
Quick Trick: Place -f immediately before archive filename [OK]
Common Mistakes:
  • Omitting the archive filename after -f
  • Misordering options causing tar to misinterpret arguments

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes