Bird
0
0

What will be the result of running this command?

medium📝 Command Output Q13 of 15
Linux CLI - File and Directory Operations
What will be the result of running this command?
mkdir -p home/user/docs
ACreates home, user, and docs directories if they don't exist
BCreates only the docs directory if home/user exists
CShows an error because -p is invalid
DDeletes existing home/user/docs directory
Step-by-Step Solution
Solution:
  1. Step 1: Understand the -p option

    The -p option tells mkdir to create parent directories as needed without error if they already exist.
  2. Step 2: Analyze the command effect

    This command creates the full path home/user/docs including any missing directories in the path.
  3. Final Answer:

    Creates home, user, and docs directories if they don't exist -> Option A
  4. Quick Check:

    mkdir -p = create nested folders [OK]
Quick Trick: Use -p to make all needed folders in one go [OK]
Common Mistakes:
  • Thinking -p only creates the last folder
  • Assuming -p is invalid or causes errors
  • Confusing mkdir with delete commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes