mkdir
command is used to create new folders and directories. mkdir
have very little options but because of the mkdir
command importance, we will examine these options.
Linux Options
There are more Linux options than Windows operating systems option. We will look these Linux options below.
Help Option
We can print help information about the mkdir
command options. We will use --help
in order to print help information about options.
$ mkdir --help

Set Folders and Directories Mode
We can use -m
or --mode
option in order to set permissions about folders and directories which will be created with the mkdir
command. In this example, we will set rwx
.
$ mkdir -m a=rwx test
Parent Option
While creating folders and directories in a recursive fashion, if the parent is not currently existed we will get an error like cannot create directory ‘ismaail/baydan/backup’: No such file or directory
. Because there is o directory like ismail
and baydan
. We can create with a single command multiple child and parent directories by using -p
option. In this example, ismail
and baydan
will be created automatically and then backup
directory will be created without a problem.
$ mkdir -p ismail/baydan/backup
Verbose Option
During folder and directory creation there will be no information about process except errors. We can print operations about folder and directory creation with the -v
option like below.
$ mkdir -p ismail/baydan/backup

SELinux Option
SELinux is a security mechanism used to protect files and folders access via processes. We can set SELinux context by using --context
option.
Windows Options
Windows operating system provides less option than Linux counterpart. We can only print usage information with the help information.
Help Option
We can print help information with the /?
option like below.
> mkdir /?
