The Linux mkdir command is used to create a directory, and its syntax is mkdir [options] directory name. Options include: -p creates the directory recursively, -v displays the creation process, -m specifies directory permissions, and -Z sets the context using SELinux. For example: mkdir my_directory creates a directory named "my_directory"; mkdir -p my_directory/sub_directory recursively creates "sub_directory" and its parent directory; mkdir -m 755 my_directory creates "my_
with permissions 755
Linux Command: mkdir
Meaning:
The mkdir command is used to create a directory in a Linux system.
Syntax:
<code>mkdir [选项] 目录名称</code>
Options:
-p
: Recursively create directories , that is, creating a directory and its parent directory at the same time. -v
: Display the process of creating a directory. -m
: Specify the permissions of the directory .-Z
: Use SELinux to set the context of the directory.Usage:
To create a directory named "my_directory", use the following command:
<code>mkdir my_directory</code>
Create a directory recursively:
To recursively create a directory and its parent directory, use -p
Options:
<code>mkdir -p my_directory/sub_directory</code>
Specify directory permissions:
To specify permissions for a directory, use the -m
option. Permissions should be in octal Numerical representation, for example:
<code>mkdir -m 755 my_directory</code>
This command will create a directory named "my_directory" with permissions 755 (rwxr-xr-x).
Use SELinux:
To set the context of a directory using SELinux, use the -Z
option:
<code>mkdir -Z context_name my_directory</code>
This command will create a directory named "my_directory" and SELinux it The context is set to "context_name".
The above is the detailed content of What does the linux command mkdir mean?. For more information, please follow other related articles on the PHP Chinese website!