If you ever need to create directory trees like this

Directory Tree

You can do this:

cd /tmp

mkdir 1

cd 1

mkdir 2

cd 2

mkdir C

or, you can just do this:

mkdir -p /tmp/1/2/3

From the man page of mkdir

-p, --parents
no error if existing, make parent directories as needed

You can also use this option to create more complicated trees. Like this one.

directory tree

Do that with this:

mkdir -p /tmp/a{1,2,B{1,2}}

Advertisements