This question already has an answer here:

Apparently, it's not possible to create a nested directory in a single command?

$ sudo mkdir x/y/z
mkdir: cannot create directory 'x/y/z': No such file or directory

marked as duplicate by slm, jasonwryan, Stéphane Chazelas, user26112, Mat Jul 24 '13 at 5:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


The command you are looking for is mkdir -p x/y/z. The -p switch create parents directories.

~$ mkdir -p d/s/a/e
~$ cd d/s/a/e/

Use the -p option. Your command should be:

sudo mkdir -p x/y/z

Not the answer you're looking for? Browse other questions tagged or ask your own question.