How to create nested directory in a single command?
232,308
Solution 1
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/
~/d/s/a/e$
Solution 2
Use the -p
option. Your command should be:
sudo mkdir -p x/y/z
Related videos on Youtube
Author by
BaltoStar
Updated on September 18, 2022Comments
-
BaltoStar almost 2 years
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
-
Rahul Lakhanpal over 7 yearsThis is the best answer.