Example: When you want to create a directory tree like this /a/b/c/d, where a,b,c,d are all not exist before, you need to create each directory independently like
mkdir /a mkdir /a/b mkdir /a/b/c mkdir /a/b/c/d
if you do mkdir /a/b/c/d, you will encounter "no such file or directory" error.
With -p option, you can create /a/b/c/d with just one single line of command as shown below:
mkdir -p /a/b/c/d