Why do we use mkdir -p i/like/icecream instead of
mkdir i/like/icecream
Hi,
Did you try the command without -p? It says “cannot creat directory “i/like/icecream”: No such file or directory”.
Because mkdir only makes a directory.
If you want to nest other directories in it, you need to use -p
Take a look at this answer:
If you’re on Windows that -p is useless, and on some versions of Windows it’s an error so just don’t use it.
If you’re not on windows then -p means “make all the directories in this PATH”. It’s a way of making each one in that long list as the mkdir command runs into any that are missing.