Linux/Unix – Making directories
Making a Directory
Use mkdir (“make directory”) to make a new directory, giving the path name of the new directory as an argument. Directory names follow the same conventions as used with other files−−that is, no spaces, slashes, or other unusual characters are recommended.
To make a new directory called `work’ in the current working directory, type:
$ mkdir work
To make a new directory called `work’ in the `/tmp’ directory, type:
$ mkdir /tmp/work
Making a Directory Tree
Use mkdir with the `−p’ option to make a subdirectory and any of its parents that do not already exist. This is useful when you want to make a fairly complex directory tree from scratch, and don’t want to have to make each directory individually.
To make the `work/completed/2008′ directory−−a subdirectory of the `completed’ directory, which in turn is a subdirectory of the `work’ directory in the current directory, type:
$ mkdir −p work/completed/2008
This makes a `2008′ subdirectory in the directory called `completed’, which in turn is in a directory called `work’ in the current directory; if the `completed’ or the `work’ directories do not already exist, they are made as well (if you know that `work’ and `completed’ both exist, the above command works fine without the `−p’ option).