Bird
0
0

You want to create directories named after months inside /backup folder using a single command: jan, feb, and mar. Which command is correct?

hard📝 Application Q9 of 15
Linux CLI - File and Directory Operations
You want to create directories named after months inside /backup folder using a single command: jan, feb, and mar. Which command is correct?
Amkdir /backup/jan; feb; mar
Bmkdir -p /backup/jan,feb,mar
Cmkdir /backup/jan feb mar
Dmkdir /backup/{jan,feb,mar}
Step-by-Step Solution
Solution:
  1. Step 1: Understand brace expansion in shell

    The syntax /backup/{jan,feb,mar} expands to create all three directories inside /backup.
  2. Step 2: Check other options

    Listing partial paths like mkdir /backup/jan feb mar creates feb and mar in the wrong location. Commas inside mkdir or semicolons are invalid here.
  3. Final Answer:

    mkdir /backup/{jan,feb,mar} -> Option D
  4. Quick Check:

    Brace expansion creates multiple dirs efficiently [OK]
Quick Trick: Use braces {a,b,c} to create multiple dirs in one command [OK]
Common Mistakes:
MISTAKES
  • Using commas inside mkdir without braces
  • Using semicolons inside mkdir
  • Not knowing brace expansion

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes