The mkdir stands for ‘make directory’. The mkdir command tool is used mostly to create directories. Simple the name of the directory as an argument to the command creates the directory. Remember, you must have write access to the parent directory to create a new directory.
The syntax command line is below :
$ mkdir <dirname>
For Example:
$ mkdir myfolder
If you don’t provide a path, then the directory will be created in the working directory. If you want to create the directory somewhere else, you have to mention the path. The mkdir command accepts both relative and absolute paths.
To make multiple directories
mkdir can create multiple directory at once. To do that, we need simply put the directory names on by one as options. You may need to type the names of the directory in double colons, if you have space in the name of any directory.
$ mkdir <dirname1> <dirname2> <dirname3> … <dirname-n>
For Example:
$ mkdir folder1 folder2 folder3
Here we’ve created three directories simultaneously
Options for mkdir:
- -p, –parents
Add directory including its sub directory. - -v, –verbose
Print a message for each created directory.
-m –mode=MODE
*Set access privilege (as in chmod)