To create nested directories using the mkdir command, you can use the -p option, which allows you to create parent directories as needed. Here’s how to do it:
Syntax:
mkdir -p parent_directory/child_directory/grandchild_directory
Example:
If you want to create a directory structure like projects/web_app/src/components, you would run:
mkdir -p projects/web_app/src/components
Explanation:
-p: This option tellsmkdirto create any necessary parent directories along the specified path.projects/web_app/src/components: This is the full path of the nested directories you want to create.
Using this command, all directories in the specified path will be created in one go, even if some of the parent directories do not already exist. If you have any further questions or need more examples, feel free to ask!
