Linux mkdir command
mkdir [-m=mode] [-p] [-v] [-Z=context] directory [directory ...]
|directory||The name of the directory to be created. If the specified directory does not already exist, mkdir creates it. More than one directory may be specified.
A specified directory can include path information. For instance, if the current directory is /home/hope, and you want to create the directory /home/hope/Documents/writing, you can use the command mkdir Documents/writing. If the Documents folder does not already exist, specify the -p option to create it automatically, otherwise the command fails.
|You can use the -m option to set a file mode (permissions, etc.) for the created directories. The syntax of mode is the same as with the chmod command.|
|Create parent directories as necessary. When this option is specified, no error is reported if a directory already exists.|
|Verbose output. Print a message for each created directory.|
|If you are using SELinux, this option sets the security context of each created directory to context. For detailed information about security contexts, consult your SELinux documentation.|
|--help||Display a help message, and exit.|
|--version||Display version information, and exit.|
mkdir returns an exit status of zero if all operations were successful, or a non-zero exit status if operations failed.
Create a new directory named myfiles in the current directory.
mkdir -m a=rwx mydir
Create the mydir directory, and set its file mode (-m) so that all users (a) may read (r), write (w), and execute (x) it.
For directories, this means that users on the system may view ("read"), and create/modify/delete ("write") files in the directory. Users may also change to ("execute") the directory, for example with the cd command.
chdir -m 777 mydir
Same as the command above, but using a numerical file mode. Grants read, write, and execute permissions to the directory for all users. (For more information about file modes, see chmod).
mkdir -p /home/hope/Documents/pdf
Creates the directory /home/hope/Documents/pdf. If any of the parent directories /home, /home/hope, or /home/hope/Documents do not already exist, they are automatically created.
rmdir — Remove a directory.