Article 4WP4M I don't quite understand how mkdir works.

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.latest?d=yIl2AUoC8zA latest?i=DLmNNm88F6A:eIXXgBiXxyE:F7zBnMy latest?i=DLmNNm88F6A:eIXXgBiXxyE:V_sGLiP latest?d=qj6IDK7rITs latest?i=DLmNNm88F6A:eIXXgBiXxyE:gIN9vFwDLmNNm88F6A
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments