I don't quite understand how mkdir works.
by uteh5 from LinuxQuestions.org on (#4WP4M)
Hello everybody i've been using linux for about 2 months now and i thought i understood mkdir. It just makes a directory.
Thing is today i was following a tutorial and it told me to do
mkdir /tmp/tutorial
At the time i was here: user@user:~/Desktop
Now this worked perfectly fine.
Then later on in the tutorial in it told me to make more directories doing this:
mkdir -p dir4/dir5/dir6
at the time i was here: user@user:/tmp/tutorial
This also worked fine.
Now the question is: Why did i have to use -p here and no slash? Why didn't i the first time? Has it got to do something with the tmp file or the place where i do the command?
See i tried doing mkdir /dir7/dir8 in the tutorial directory and this didn't work.
I also tried doing mkdir /dir7/dir8 in the Desktop directory and this didn't work either. Please help?
Ill be eagerly waiting a response.


Thing is today i was following a tutorial and it told me to do
mkdir /tmp/tutorial
At the time i was here: user@user:~/Desktop
Now this worked perfectly fine.
Then later on in the tutorial in it told me to make more directories doing this:
mkdir -p dir4/dir5/dir6
at the time i was here: user@user:/tmp/tutorial
This also worked fine.
Now the question is: Why did i have to use -p here and no slash? Why didn't i the first time? Has it got to do something with the tmp file or the place where i do the command?
See i tried doing mkdir /dir7/dir8 in the tutorial directory and this didn't work.
I also tried doing mkdir /dir7/dir8 in the Desktop directory and this didn't work either. Please help?
Ill be eagerly waiting a response.