What does the -p option do in mkdir command?

The -p option in the mkdir command allows you to create parent directories as needed. This means that if the specified parent directory does not exist, it will be created automatically.

Example:

If you run:

mkdir -p /path/to/new/directory
  • If /path/to does not exist, it will be created along with new and directory.
  • If any of the parent directories already exist, mkdir -p will not raise an error and will simply create the specified directory.

This option is useful for creating nested directory structures in a single command. If you have more questions, feel free to ask!

0 Comments

no data
Be the first to share your comment!