It works like this:

A note on notation:

Directories is a great place to store and organize files, and creating them is easy. The mkdir command is used to create directories. To create a directory we can use the mkdir command followed by the name of the directory we wish to create.

mkdir directory...

Note: the three periods follow an arguments in the description in above, it means that the arguments can be repeated.

$ mkdir foo
$ ls -l
drwxr-xr-x   2 bindi  staff        68 15 Sep 23:17 foo
$ mkdir foo bar
$ ls -l
drwxr-xr-x   2 bindi  staff        68 15 Sep 23:17 foo
drwxr-xr-x   2 bindi  staff        68 15 Sep 23:17 bar

Create Intermediate Directories ( -p )

The mkdir command allows us to create nested directories using the -p flag.

$ mkdir -p foo/bar/now
$ ls -la /foo/bar/now
total 0
drwxr-xr-x  2 robin  staff   68 16 Sep 00:38 .
drwxr-xr-x  3 robin  staff  102 16 Sep 00:38 ..

Above shos the ls command to see that now directory exists and currently empty.

Verbose Output ( -v )

The mkdir command supports a verbose mode flag, -v . Adding the -v flag will print the results of mkdir to the console.

$ mkdir -v foo
madir: created directory 'foo'

Using the -v flag can provide useful report when writing scripts with lot of commands.