Create multiple subfolders
mkdir -p parent/{folder1,folder2,folder3,folder4,folder5}
.
├── main
│ ├── folder1
│ ├── folder2
│ ├── folder3
│ ├── folder4
│ └── folder5
Written by Nicolas RAMY
Related protips
8 Responses

What's the difference from
mkdir folder1 folder2 folder3 folder4 folder5
?

The difference is you can make multiple subfolders without write the base path.
Try mkdir -p parentFolder/childFolder/{folder1,folder2,folder3,folder4,folder5}

@nantunes I think its the same.
though like this usage is affective:
mkdir -p foo/{bar,baz}

Oh, great! :-)

@tacahiroy yes it's what I want to say with this "pro tip"

I have updated it to better illustrate the purpose of this "pro tips"

Not to forget that you can have folders after the set. mkdir -p foo/{bar,baz}/hello
will create
foo/
bar/
hello/
baz/
hello/
Or you can have a partial name. mkdir hello{1..5}world
will create hello1world, hello2world, hello3world, etc.
Manual entry: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_04.html

Thanks @shawncplus for the precision