The purpose of the -p option in the mkdir command is to create parent directories as needed. It allows you to create a complete directory path in one command, ensuring that all specified parent directories are created if they do not already exist. This simplifies the process of setting up nested directory structures.
