Bird
0
0

You want to create a directory structure project/src/components inside your home folder, but project does not exist yet. Which command will do this correctly?

hard📝 Application Q8 of 15
Linux CLI - File and Directory Operations
You want to create a directory structure project/src/components inside your home folder, but project does not exist yet. Which command will do this correctly?
Amkdir -p project/src/components
Bmkdir -p ~/project/src/components
Cmkdir ~/project/src/components
Dmkdir ~/project; mkdir ~/src; mkdir ~/components
Step-by-Step Solution
Solution:
  1. Step 1: Understand nested directory creation with -p

    The -p option creates all missing parent directories in the path.
  2. Step 2: Check path correctness

    Using ~ points to home directory. Without -p, mkdir fails if parents missing. Separate mkdir commands create unrelated folders.
  3. Final Answer:

    mkdir -p ~/project/src/components -> Option B
  4. Quick Check:

    Use -p with full path to create nested dirs [OK]
Quick Trick: Use -p and ~ for nested dirs in home folder [OK]
Common Mistakes:
MISTAKES
  • Omitting -p for nested dirs
  • Not using ~ for home path
  • Creating unrelated directories separately

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes