FG
💻 Software

What does the -p flag do in "mkdir -p"?

Fresh7 days ago
Mar 15, 2026187430 views
Confidence Score1%
1%

Problem

What does the flag do in ?

Error Output

-p

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: What does the -p flag do in "mkdir -p"?

Low Risk

The flag will create nested directories, but only if they don't exist already. For example, suppose you have a directory that you have write permissions for. It is also an idempotent operation, because if you run the same command over again, you will not get an error, but nothing will be created.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment