How to use mkdir?

For some time now I’ve been using Linux but I don’t quite get it how to use mkdir, it creates only a directory. In a tutorial, it told me to do mkdir / tmp/tutorial, and it works perfectly fine. And then it told me to make more directories by doing this: mkdir -p dir4/dir5/dir6, and it was also successful.
But now the question is how to use -p here, and not slash? Does it have to do something with the tmp file or at the place of command?
I tried to do mkdir / dir7/di8 in the tutorial directory, and mkdir /dir7/dir8 in the desktop directory, but both didn’t work. Can anybody help me?

Hello @Jaxon

Welcome to community! :bouquet:

you can use mkdir -p to make parent directory, if you don’t want to make parent directory of sub directory then you don’t need to use -p

example: mkdir abc (it will make directoy named abc)
mkdir -p abcd/a1 (it will make parent directory abcd and
sub diectory a1 in abcd folder)

mkdir : will create a directory
mkdir -p : will create parent directory and will follow sub directories.

Hey there!
Check this link for the solution, it also shows how to do it with examples