Javatpoint Logo
Javatpoint Logo

Linux Directories mkdir -p

With the help of mkdir -p command you can create sub-directories of a directory. It will create parent directory first, if it doesn't exist. But if it already exists, then it will not print an error message and will move further to create sub-directories.


This command is most helpful in the case when you don't know whether a directory alredy exists or not. For instance, in the above screenshot I wanted to create a 'docu' in 'created'. As you know, we already have directory 'created'. Hence, without showing an error it will create 'docu'. You can see the 'docu' directory above.

Now in the later part of the image if you'll see, I have created a directory 'envelope' with its sub-directory 'letter'. As directory 'envelope' doesn't exists, it will first create 'envelope' and then its sub-directory 'letter' without printing any error.

Hence this command is very useful to create a long file like "office/client/raj/date". With mkdir command you have to ceate every file one by one. But mkdir -p command will create it at once.

Next TopicFull Form

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA